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.
This commit is contained in:
Alan Orth 2016-08-14 16:33:48 +03:00
parent 7589136453
commit e343ddc9a6
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
8 changed files with 15 additions and 9 deletions

View File

@ -5,6 +5,7 @@
with_items: with_items:
- firewalld - firewalld
- tidy - tidy
tags: packages
- name: Copy firewalld public zone file - name: Copy firewalld public zone file
when: ansible_distribution_major_version == '8' when: ansible_distribution_major_version == '8'

View File

@ -2,6 +2,7 @@
- name: Install iptables-persistent - name: Install iptables-persistent
when: ansible_distribution_version == '14.04' when: ansible_distribution_version == '14.04'
apt: pkg=iptables-persistent update_cache=yes apt: pkg=iptables-persistent update_cache=yes
tags: packages
- name: Copy /etc/iptables/rules.v4 - name: Copy /etc/iptables/rules.v4
when: ansible_distribution_version == '14.04' when: ansible_distribution_version == '14.04'
@ -21,6 +22,7 @@
with_items: with_items:
- firewalld - firewalld
- tidy - tidy
tags: packages
- name: Copy firewalld public zone file - name: Copy firewalld public zone file
when: ansible_distribution_version >= '15.04' when: ansible_distribution_version >= '15.04'

View File

@ -1,25 +1,25 @@
--- ---
- name: Add GPG key for MariaDB repo - name: Add GPG key for MariaDB repo
apt_key: id=0xcbcb082a1bb943db url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xcbcb082a1bb943db 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 - name: Remove old repo file
file: path={{ item }} state=absent file: path={{ item }} state=absent
with_items: 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_debian.list
- /etc/apt/sources.list.d/sgp1_mirrors_digitalocean_com_mariadb_repo_10_1_ubuntu.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 - 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 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 - name: Install mariadb-server
apt: name={{ item }} state=present update_cache=yes apt: name={{ item }} state=present update_cache=yes
with_items: with_items:
- mariadb-server - mariadb-server
- python-mysqldb # for ansible - python-mysqldb # for ansible
tags: mariadb tags: mariadb, packages
- name: Create system my.cnf - name: Create system my.cnf
template: src=my.cnf.j2 dest=/etc/mysql/my.cnf owner=root group=root mode=0644 template: src=my.cnf.j2 dest=/etc/mysql/my.cnf owner=root group=root mode=0644

View File

@ -4,6 +4,7 @@
when: ansible_os_family == "Ubuntu" when: ansible_os_family == "Ubuntu"
with_items: with_items:
- munin-node - munin-node
tags: packages
# some nice things to have for munin-node on Ubuntu # some nice things to have for munin-node on Ubuntu
- name: Install munin-node deps - name: Install munin-node deps
@ -11,6 +12,7 @@
apt: name={{ item }} state=present apt: name={{ item }} state=present
with_items: with_items:
- libwww-perl #for munin's nginx_status check - libwww-perl #for munin's nginx_status check
tags: packages
- name: Create munin-node.conf - name: Create munin-node.conf
template: src=munin-node.conf.j2 dest=/etc/munin/munin-node.conf template: src=munin-node.conf.j2 dest=/etc/munin/munin-node.conf

View File

@ -4,6 +4,7 @@
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
with_items: with_items:
- munin - munin
tags: packages
- name: Create munin configuration file - name: Create munin configuration file
template: src=munin.conf.j2 dest=/etc/munin/munin.conf owner=root group=root mode=0644 template: src=munin.conf.j2 dest=/etc/munin/munin.conf owner=root group=root mode=0644

View File

@ -1,15 +1,15 @@
--- ---
- name: Add nginx.org apt signing key - name: Add nginx.org apt signing key
apt_key: url=http://nginx.org/keys/nginx_signing.key state=present apt_key: url=http://nginx.org/keys/nginx_signing.key state=present
tags: nginx tags: nginx, packages
- name: Add nginx.org repo - 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 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 - name: Install nginx
apt: pkg=nginx update_cache=yes state=latest apt: pkg=nginx update_cache=yes state=latest
tags: nginx tags: nginx, packages
- name: Copy nginx configs - name: Copy nginx configs
copy: src={{ item }} dest=/etc/nginx/{{ item }} mode=0644 owner=root group=root copy: src={{ item }} dest=/etc/nginx/{{ item }} mode=0644 owner=root group=root

View File

@ -7,7 +7,7 @@
- php5-mysql - php5-mysql
- php5-gd - php5-gd
- php5-curl - php5-curl
tags: php-fpm tags: php-fpm, packages
- name: Copy php5-fpm pool config - 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 template: src=pool.conf.j2 dest=/etc/php5/fpm/pool.d/{{ item.domain_name }}.conf owner=root group=root mode=0644

View File

@ -10,7 +10,7 @@
# for Piwik # for Piwik
- php7.0-mbstring - php7.0-mbstring
- php7.0-xml - php7.0-xml
tags: php-fpm tags: php-fpm, packages
- name: Copy php-fpm pool config - 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 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