From e343ddc9a63070ccf8c064a435ba36507cfa4651 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sun, 14 Aug 2016 16:33:48 +0300 Subject: [PATCH] Add 'packages' tag to any task doing package stuff For idempotence we need to run all apt-related tasks, like editing source files, adding keys, installing packages, etc, when running the 'packages' tag. --- roles/common/tasks/iptables_Debian.yml | 1 + roles/common/tasks/iptables_Ubuntu.yml | 2 ++ roles/mariadb/tasks/main.yml | 8 ++++---- roles/munin/tasks/munin-node.yml | 2 ++ roles/munin/tasks/munin.yml | 1 + roles/nginx/tasks/main.yml | 6 +++--- roles/php-fpm/tasks/Debian.yml | 2 +- roles/php-fpm/tasks/Ubuntu.yml | 2 +- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/roles/common/tasks/iptables_Debian.yml b/roles/common/tasks/iptables_Debian.yml index a595676..7a90b16 100644 --- a/roles/common/tasks/iptables_Debian.yml +++ b/roles/common/tasks/iptables_Debian.yml @@ -5,6 +5,7 @@ with_items: - firewalld - tidy + tags: packages - name: Copy firewalld public zone file when: ansible_distribution_major_version == '8' diff --git a/roles/common/tasks/iptables_Ubuntu.yml b/roles/common/tasks/iptables_Ubuntu.yml index 54a5d85..e13becd 100644 --- a/roles/common/tasks/iptables_Ubuntu.yml +++ b/roles/common/tasks/iptables_Ubuntu.yml @@ -2,6 +2,7 @@ - name: Install iptables-persistent when: ansible_distribution_version == '14.04' apt: pkg=iptables-persistent update_cache=yes + tags: packages - name: Copy /etc/iptables/rules.v4 when: ansible_distribution_version == '14.04' @@ -21,6 +22,7 @@ with_items: - firewalld - tidy + tags: packages - name: Copy firewalld public zone file when: ansible_distribution_version >= '15.04' diff --git a/roles/mariadb/tasks/main.yml b/roles/mariadb/tasks/main.yml index 645db96..52e054d 100644 --- a/roles/mariadb/tasks/main.yml +++ b/roles/mariadb/tasks/main.yml @@ -1,25 +1,25 @@ --- - name: Add GPG key for MariaDB repo apt_key: id=0xcbcb082a1bb943db url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xcbcb082a1bb943db - tags: mariadb + tags: mariadb, packages - name: Remove old repo file file: path={{ item }} state=absent with_items: - /etc/apt/sources.list.d/sgp1_mirrors_digitalocean_com_mariadb_repo_10_1_debian.list - /etc/apt/sources.list.d/sgp1_mirrors_digitalocean_com_mariadb_repo_10_1_ubuntu.list - tags: mariadb + tags: mariadb, packages - name: Add MariaDB 10.1 repo template: src=mariadb.list.j2 dest=/etc/apt/sources.list.d/mariadb.list owner=root group=root mode=0644 - tags: mariadb + tags: mariadb, packages - name: Install mariadb-server apt: name={{ item }} state=present update_cache=yes with_items: - mariadb-server - python-mysqldb # for ansible - tags: mariadb + tags: mariadb, packages - name: Create system my.cnf template: src=my.cnf.j2 dest=/etc/mysql/my.cnf owner=root group=root mode=0644 diff --git a/roles/munin/tasks/munin-node.yml b/roles/munin/tasks/munin-node.yml index b1402d8..7f72afa 100644 --- a/roles/munin/tasks/munin-node.yml +++ b/roles/munin/tasks/munin-node.yml @@ -4,6 +4,7 @@ when: ansible_os_family == "Ubuntu" with_items: - munin-node + tags: packages # some nice things to have for munin-node on Ubuntu - name: Install munin-node deps @@ -11,6 +12,7 @@ apt: name={{ item }} state=present with_items: - libwww-perl #for munin's nginx_status check + tags: packages - name: Create munin-node.conf template: src=munin-node.conf.j2 dest=/etc/munin/munin-node.conf diff --git a/roles/munin/tasks/munin.yml b/roles/munin/tasks/munin.yml index 71ea0ae..bf7b125 100644 --- a/roles/munin/tasks/munin.yml +++ b/roles/munin/tasks/munin.yml @@ -4,6 +4,7 @@ when: ansible_os_family == "Debian" with_items: - munin + tags: packages - name: Create munin configuration file template: src=munin.conf.j2 dest=/etc/munin/munin.conf owner=root group=root mode=0644 diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml index fa9484e..8f92dba 100644 --- a/roles/nginx/tasks/main.yml +++ b/roles/nginx/tasks/main.yml @@ -1,15 +1,15 @@ --- - name: Add nginx.org apt signing key apt_key: url=http://nginx.org/keys/nginx_signing.key state=present - tags: nginx + tags: nginx, packages - name: Add nginx.org repo template: src=nginx_org_sources.list.j2 dest=/etc/apt/sources.list.d/nginx_org_sources.list owner=root group=root mode=0644 - tags: nginx + tags: nginx, packages - name: Install nginx apt: pkg=nginx update_cache=yes state=latest - tags: nginx + tags: nginx, packages - name: Copy nginx configs copy: src={{ item }} dest=/etc/nginx/{{ item }} mode=0644 owner=root group=root diff --git a/roles/php-fpm/tasks/Debian.yml b/roles/php-fpm/tasks/Debian.yml index af91ad0..371c975 100644 --- a/roles/php-fpm/tasks/Debian.yml +++ b/roles/php-fpm/tasks/Debian.yml @@ -7,7 +7,7 @@ - php5-mysql - php5-gd - php5-curl - tags: php-fpm + tags: php-fpm, packages - name: Copy php5-fpm pool config template: src=pool.conf.j2 dest=/etc/php5/fpm/pool.d/{{ item.domain_name }}.conf owner=root group=root mode=0644 diff --git a/roles/php-fpm/tasks/Ubuntu.yml b/roles/php-fpm/tasks/Ubuntu.yml index e63629b..c2ec940 100644 --- a/roles/php-fpm/tasks/Ubuntu.yml +++ b/roles/php-fpm/tasks/Ubuntu.yml @@ -10,7 +10,7 @@ # for Piwik - php7.0-mbstring - php7.0-xml - tags: php-fpm + tags: php-fpm, packages - name: Copy php-fpm pool config template: src=php7.0-pool.conf.j2 dest=/etc/php/7.0/fpm/pool.d/{{ item.domain_name }}.conf owner=root group=root mode=0644