From c5d0b66d61b7b5fe2b687ab850c52409e1925d15 Mon Sep 17 00:00:00 2001 From: Scott Rubin Date: Sun, 25 Jul 2021 17:21:15 -0400 Subject: [PATCH] Update all system packages to latest versions on deployment. Make sure acl package is installed. closes #2 closes #11 --- ansible/roles/cache/tasks/install_memcached.yml | 2 +- ansible/roles/common/tasks/main.yml | 1 + ansible/roles/common/tasks/upgrade.yml | 13 +++++++++++++ ansible/roles/db/tasks/configure_postgres.yml | 1 + ansible/roles/db/tasks/install_postgres.yml | 1 + ansible/roles/postfix/tasks/local_only.yml | 4 ++-- ansible/roles/python/tasks/install_python.yml | 2 ++ ansible/roles/queue/tasks/install_rabbitmq.yml | 2 +- ansible/roles/web/tasks/nginx.yml | 3 +-- 9 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 ansible/roles/common/tasks/upgrade.yml diff --git a/ansible/roles/cache/tasks/install_memcached.yml b/ansible/roles/cache/tasks/install_memcached.yml index e0ad929..3d8603e 100644 --- a/ansible/roles/cache/tasks/install_memcached.yml +++ b/ansible/roles/cache/tasks/install_memcached.yml @@ -2,7 +2,7 @@ - name: Install memcached ansible.builtin.apt: name: memcached - state: present + state: latest update_cache: yes become: yes diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml index 5a49f44..0cf7df3 100644 --- a/ansible/roles/common/tasks/main.yml +++ b/ansible/roles/common/tasks/main.yml @@ -1,4 +1,5 @@ --- +- include_tasks: upgrade.yml - include_tasks: register_vars.yml - include_tasks: make_dirs.yml - include_tasks: deploy_key.yml diff --git a/ansible/roles/common/tasks/upgrade.yml b/ansible/roles/common/tasks/upgrade.yml new file mode 100644 index 0000000..e8722ce --- /dev/null +++ b/ansible/roles/common/tasks/upgrade.yml @@ -0,0 +1,13 @@ +--- +- name: Update System Packages + ansible.builtin.apt: + upgrade: dist + update_cache: yes + become: yes + +- name: Install acl + ansible.builtin.apt: + name: acl + state: latest + become: yes +... diff --git a/ansible/roles/db/tasks/configure_postgres.yml b/ansible/roles/db/tasks/configure_postgres.yml index ec79859..3fc4b34 100644 --- a/ansible/roles/db/tasks/configure_postgres.yml +++ b/ansible/roles/db/tasks/configure_postgres.yml @@ -4,6 +4,7 @@ pkg: - libpq-dev - python3-psycopg2 + state: latest become: yes - name: Create PostgreSQL database diff --git a/ansible/roles/db/tasks/install_postgres.yml b/ansible/roles/db/tasks/install_postgres.yml index d7e3206..f7962fa 100644 --- a/ansible/roles/db/tasks/install_postgres.yml +++ b/ansible/roles/db/tasks/install_postgres.yml @@ -16,6 +16,7 @@ - name: Install PostgreSQL ansible.builtin.apt: name: postgresql + state: latest update_cache: yes become: yes diff --git a/ansible/roles/postfix/tasks/local_only.yml b/ansible/roles/postfix/tasks/local_only.yml index 37827d2..a0f2cdd 100644 --- a/ansible/roles/postfix/tasks/local_only.yml +++ b/ansible/roles/postfix/tasks/local_only.yml @@ -17,7 +17,7 @@ - name: Install postfix ansible.builtin.apt: - pkg: - - postfix + name: postfix + state: latest become: yes ... diff --git a/ansible/roles/python/tasks/install_python.yml b/ansible/roles/python/tasks/install_python.yml index 4d57dae..6b92988 100644 --- a/ansible/roles/python/tasks/install_python.yml +++ b/ansible/roles/python/tasks/install_python.yml @@ -14,6 +14,7 @@ - python3-pip - python3-setuptools - python3-venv + state: latest become: yes - name: Set python3 as default @@ -39,6 +40,7 @@ - tk-dev - python3-tk - zlib1g-dev + state: latest become: yes - name: Upgrade pip using pip diff --git a/ansible/roles/queue/tasks/install_rabbitmq.yml b/ansible/roles/queue/tasks/install_rabbitmq.yml index 30e0dda..f5f4678 100644 --- a/ansible/roles/queue/tasks/install_rabbitmq.yml +++ b/ansible/roles/queue/tasks/install_rabbitmq.yml @@ -2,7 +2,7 @@ - name: Install rabbitmq ansible.builtin.apt: name: rabbitmq-server - state: present + state: latest update_cache: yes become: yes diff --git a/ansible/roles/web/tasks/nginx.yml b/ansible/roles/web/tasks/nginx.yml index b1925f3..2b323f8 100644 --- a/ansible/roles/web/tasks/nginx.yml +++ b/ansible/roles/web/tasks/nginx.yml @@ -2,8 +2,7 @@ - name: Install NGINX ansible.builtin.apt: name: "nginx" - state: present - update_cache: yes + state: latest become: yes - name: Ensure NGINX is started