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

View File

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

View File

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

View File

@ -1,2 +1,2 @@
# main docker repo # main docker repo
deb {{docker_apt_url}}/repo {{ansible_distribution|lower}}-{{ansible_distribution_release|lower}} main deb {{ docker_apt_url }}/repo {{ ansible_distribution | lower }}-{{ ansible_distribution_release | lower }} main

View File

@ -16,7 +16,7 @@ DOCKER_OPTS=""
DOCKER_OPTS="$DOCKER_OPTS --storage-driver={{ docker_storage_driver }}" DOCKER_OPTS="$DOCKER_OPTS --storage-driver={{ docker_storage_driver }}"
{% endif %} {% endif %}
{% if docker_registry %} {% if docker_registry %}
DOCKER_OPTS="$DOCKER_OPTS --insecure-registry {{ docker_registry }}" DOCKER_OPTS="$DOCKER_OPTS --insecure-registry {{ docker_registry }}"
{% endif %} {% endif %}
# If you need Docker to use an HTTP proxy, it can also be specified here. # If you need Docker to use an HTTP proxy, it can also be specified here.

View File

@ -1,6 +1,6 @@
[docker-repo] [docker-repo]
name=Docker main Repository name=Docker main Repository
baseurl={{docker_yum_url}}/repo/main/{{ansible_distribution|lower}}/{{ansible_distribution_major_version|lower}} baseurl={{ docker_yum_url }}/repo/main/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version | lower }}
enabled=1 enabled=1
gpgcheck=1 gpgcheck=1
gpgkey={{docker_yum_url}}/gpg gpgkey={{ docker_yum_url }}/gpg