Unify global syntax in baremetal role

Baremetal roles does not keep common sytax used
in rest of the roles, even it baremetal role some
tasks differs in syntax with each others.

Change-Id: Ib04fe123501e2a3e829176953f20719a253999d3
This commit is contained in:
Eduardo Gonzalez 2017-09-19 11:23:20 +02:00
parent 3e59bffff3
commit aa0209c9a4
6 changed files with 51 additions and 23 deletions

View File

@ -7,7 +7,9 @@
# TODO(inc0): Gates don't seem to have ufw executable, check for it instead of ignore errors
- name: Set firewall default policy
become: True
ufw: state=disabled policy=allow
ufw:
state: disabled
policy: allow
when: ansible_os_family == 'Debian'
ignore_errors: yes
@ -30,40 +32,53 @@
- firewalld_check.rc == 0
- name: Install apt packages
package: name={{item}} state=present
package:
name: "{{ item }}"
state: present
become: True
with_items: "{{ debian_pkg_install }}"
when: ansible_os_family == 'Debian'
- name: Install deltarpm packages
package: name={{item}} state=installed
package:
name: "{{ item }}"
state: installed
become: True
with_items:
- deltarpm
when: ansible_os_family == 'RedHat'
- name: Install yum packages
package: name={{item}} state=present
package:
name: "{{ item }}"
state: present
become: True
with_items: "{{ redhat_pkg_install }}"
when: ansible_os_family == 'RedHat'
- name: Install pip
easy_install: name=pip
easy_install:
name: pip
become: True
- name: Install docker SDK for python
pip: name=docker state=latest
pip:
name: docker
state: latest
become: True
- name: Remove packages
package: name={{item}} state=absent
package:
name: "{{ item }}"
state: absent
with_items: "{{ ubuntu_pkg_removals }}"
become: True
when: ansible_distribution|lower == "ubuntu"
- name: Remove packages
package: name={{item}} state=absent
package:
name: "{{ item }}"
state: absent
with_items: "{{ redhat_pkg_removals }}"
become: True
when: ansible_os_family == 'RedHat'

View File

@ -1,16 +1,16 @@
---
- name: Ensure docker service directory exists
file:
path=/etc/systemd/system/docker.service.d
state=directory
recurse=yes
path: /etc/systemd/system/docker.service.d
state: directory
recurse: yes
become: True
- name: Configure docker service
become: True
template:
src=docker_systemd_service.j2
dest=/etc/systemd/system/docker.service.d/kolla.conf
src: docker_systemd_service.j2
dest: /etc/systemd/system/docker.service.d/kolla.conf
register: docker_configured
- name: Reload docker service file
@ -18,7 +18,8 @@
command: systemctl daemon-reload
- name: Get stat of libvirtd apparmor profile
stat: path=/etc/apparmor.d/usr.sbin.libvirtd
stat:
path: /etc/apparmor.d/usr.sbin.libvirtd
register: apparmor_libvirtd_profile
when: ansible_distribution == "Ubuntu"

View File

@ -35,11 +35,15 @@
'ansible_' + hostvars[inventory_hostname]['api_interface'] in hostvars[inventory_hostname]
- name: Ensure sudo group is present
group: name=sudo state=present
group:
name: sudo
state: present
become: True
- name: Ensure kolla group is present
group: name=kolla state=present
group:
name: kolla
state: present
become: True
when: create_kolla_user | bool
@ -74,7 +78,9 @@
when: ansible_os_family == 'Debian'
- name: Install ubuntu ca certs
package: name={{item}} state=latest
package:
name: "{{ item }}"
state: latest
become: True
with_items:
- ca-certificates
@ -83,7 +89,10 @@
- ansible_os_family == 'Debian'
- name: Ensure apt sources list directory exists
file: path=/etc/apt/sources.list.d state=directory recurse=yes
file:
path: /etc/apt/sources.list.d
state: directory
recurse: yes
become: True
when: ansible_os_family == 'Debian'
@ -105,7 +114,10 @@
- ansible_distribution == 'Ubuntu'
- name: Ensure yum repos directory exists
file: path=/etc/yum.repos.d/ state=directory recurse=yes
file:
path: /etc/yum.repos.d/
state: directory
recurse: yes
become: True
when: ansible_os_family == 'RedHat'