Skip to content

Commit

Permalink
changes to fix ansible-lint errors (#24)
Browse files Browse the repository at this point in the history
* changes to fix ansible-lint errors

* attempt to move to configfile

* change to option c

* fix lint error

* fix ansible-lint config file location

* put latest back becuase it's needed
  • Loading branch information
ericsysmin authored and Gaurav Rastogi committed Feb 4, 2019
1 parent 5dd3a50 commit 5f039cc
Show file tree
Hide file tree
Showing 19 changed files with 164 additions and 12 deletions.
6 changes: 6 additions & 0 deletions molecule/default/.ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
parseable: true
skip_list:
- ANSIBLE0010
use_default_rules: true
verbosity: 1
3 changes: 1 addition & 2 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ provisioner:
lint:
name: ansible-lint
options:
x:
- ANSIBLE0010
c: molecule/default/.ansible-lint
playbooks:
converge: ${MOLECULE_PLAYBOOK:-playbook.yml}
scenario:
Expand Down
12 changes: 12 additions & 0 deletions tasks/ce/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
- docker-engine
- docker-io
state: absent
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: Docker | CE | APT | Install Prerequisits for APT
apt:
Expand All @@ -16,6 +20,10 @@
- software-properties-common
- gnupg2
state: present
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: Docker | CE | APT | Add repository key
block:
Expand Down Expand Up @@ -48,3 +56,7 @@
- name: Docker | CE | APT | Install docker-ce
apt: name=docker-ce state=present
notify: Docker | Restart Docker
register: task_result
until: task_result is success
retries: 10
delay: 2
12 changes: 12 additions & 0 deletions tasks/ce/dnf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
rescue:
- name: Docker | CE | DNF | Ensure curl is present (systems without SNI).
package: name=curl
register: task_result
until: task_result is success
retries: 10
delay: 2
- name: Docker | CE | DNF | Download GPG key (systems without SNI).
shell: "curl -sSL {{ docker_ce_gpg_key }} -o /tmp/docker-gpg"
- name: Docker | CE | DNF | Add Docker GPG key (systems without SNI).
Expand All @@ -33,6 +37,10 @@
rescue:
- name: Docker | CE | DNF | Install dnf-utils (systems without SNI)
dnf: name=dnf-plugins-core
register: task_result
until: task_result is success
retries: 10
delay: 2
- name: Docker | CE | DNF | Deploy repository (systems without SNI)
shell: "dnf config-manager --add-repo {{ docker_ce_repo_file_url }}"
args:
Expand Down Expand Up @@ -60,3 +68,7 @@
name: docker-ce
state: present
notify: Docker | Restart Docker
register: task_result
until: task_result is success
retries: 10
delay: 2
8 changes: 8 additions & 0 deletions tasks/ce/os/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@
- name: Docker | CE | Ubuntu | Install the linux-image-extra kernal package
apt: name="linux-image-extra-{{ ansible_kernel }}" state=present
when: ansible_distribution_version in ['14.04','15.10']
register: task_result
until: task_result is success
retries: 10
delay: 2

# If you are installing on Ubuntu 14.04, apparmor is required.
- name: Docker | CE | Ubuntu | Install AppArmor Dependency
apt: name=apparmor state=present
when: ansible_distribution_version in "14.04"
register: task_result
until: task_result is success
retries: 10
delay: 2
8 changes: 8 additions & 0 deletions tasks/ce/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
rescue:
- name: Docker | CE | YUM | Install yum-utils (systems without SNI)
yum: name=yum-utils
register: task_result
until: task_result is success
retries: 10
delay: 2
- name: Docker | CE | YUM | Deploy repository (systems without SNI)
shell: "yum-config-manager --add-repo {{ docker_ce_repo_file_url }}"
args:
Expand Down Expand Up @@ -60,3 +64,7 @@
name: docker-ce
state: present
notify: Docker | Restart Docker
register: task_result
until: task_result is success
retries: 10
delay: 2
2 changes: 1 addition & 1 deletion tasks/deploy_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- name: Docker | Deploy Config | Set the Docker configuration
set_fact:
docker_config: "{{ docker_config|combine({ item.key: item.value }) }}"
when: item.value != ""
when: item.value | length > 0
with_dict: "{{ docker_options }}"

- name: Docker | Deploy Config | Deploy /etc/docker/daemon.json
Expand Down
12 changes: 12 additions & 0 deletions tasks/ee/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
- ca-certificates
- curl
- software-properties-common
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: Docker | EE | APT | Perform specific os tasks
include: os/{{ ansible_distribution|lower }}.yml
Expand All @@ -17,7 +21,15 @@
- docker
- docker-engine
- docker-ce
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: Docker | EE | APT | Install Docker Engine
apt: name=docker-ee state=present
notify: Docker | Restart Docker
register: task_result
until: task_result is success
retries: 10
delay: 2
8 changes: 8 additions & 0 deletions tasks/ee/os/oraclelinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
gpgcheck: 1
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
when: ansible_distribution_major_version == "7"
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: Docker | EE | YUM | Oracle Linux | Enable UEK R4
yum_repository:
Expand All @@ -18,3 +22,7 @@
gpgcheck: 1
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
when: ansible_distribution_major_version == "7"
register: task_result
until: task_result is success
retries: 10
delay: 2
8 changes: 8 additions & 0 deletions tasks/ee/os/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@
- name: Docker | EE | Ubuntu | Install the linux-image-extra kernal package
apt: name="linux-image-extra-{{ ansible_kernel }}" state=present
when: ansible_distribution_version in ['14.04','15.10']
register: task_result
until: task_result is success
retries: 10
delay: 2

# If you are installing on Ubuntu 14.04 or 12.04, apparmor is required.
- name: Docker | EE | Ubuntu | Install AppArmor Dependency
apt: name=apparmor state=present
when: ansible_distribution_version in "14.04"
register: task_result
until: task_result is success
retries: 10
delay: 2

# Check and see if the GPG key already exists on the host
- name: Docker | CE | APT | Check GPG Key
Expand Down
12 changes: 12 additions & 0 deletions tasks/ee/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- name: Docker | EE | YUM | Install yum-utils
yum: name=yum-utils
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: Docker | EE | YUM | Deploy repository
shell: "yum-config-manager --add-repo {{ docker_ee_url }}/docker-ee.repo"
Expand All @@ -25,7 +29,15 @@
- docker-engine-selinux
- docker-engine
- docker-ce
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: Docker | EE | YUM | Install Docker Application
yum: name=docker-ee state=present
notify: Docker | Restart Docker
register: task_result
until: task_result is success
retries: 10
delay: 2
20 changes: 20 additions & 0 deletions tasks/legacy/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,19 @@
- name: Ubuntu | Install the linux-image-extra kernal package
apt: name="linux-image-extra-{{ ansible_kernel }}" state=present
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version in ['14.04','15.10']
register: task_result
until: task_result is success
retries: 10
delay: 2

# If you are installing on Ubuntu 14.04 or 12.04, apparmor is required.
- name: Ubuntu | Install AppArmor Dependency
apt: name=apparmor state=present
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version in ['14.04','12.04']
register: task_result
until: task_result is success
retries: 10
delay: 2

# Docker requires that your kernel be set to 3.13 or higher.
- name: Ubuntu | Update Kernel Version to >= 3.13
Expand All @@ -34,6 +42,10 @@
- linux-image-generic-lts-trusty
- linux-headers-generic-lts-trusty
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '12.04'
register: task_result
until: task_result is success
retries: 10
delay: 2

# Before we start docker, we need to make sure the system is running on Kernel 3.13 or higher.
- name: Ubuntu | Update Kernel Version to >= 3.13 | Reboot Host
Expand All @@ -52,7 +64,15 @@
# Remove any previous version of docker.
- name: APT | Remove old repo lxc-docker
apt: name=lxc-docker state=absent
register: task_result
until: task_result is success
retries: 10
delay: 2

# Install newer version of docker.
- name: APT | Install Docker Engine
apt: name=docker-engine state=present
register: task_result
until: task_result is success
retries: 10
delay: 2
8 changes: 8 additions & 0 deletions tasks/legacy/dnf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@

- name: DNF | Remove Old Docker
dnf: name=docker state=absent
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: DNF | Install Docker Application
dnf: name=docker-engine state=present
notify: Docker | Restart Docker
register: task_result
until: task_result is success
retries: 10
delay: 2
8 changes: 8 additions & 0 deletions tasks/legacy/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
- docker
- docker-io
state: absent
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: Docker | YUM | Configure Docker repository
yum_repository:
Expand All @@ -38,3 +42,7 @@
- name: Docker | YUM | Install Docker Application
yum: name=docker-engine state=present
notify: Docker | Restart Docker
register: task_result
until: task_result is success
retries: 10
delay: 2
15 changes: 10 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
- name: Check ansible version
when:
- ansible_version.full is version_compare('2.4', '<')
debug: msg="This role works best with ansible version 2.4 or greater. It is recommended to use the latest ansible version for the best experience."
debug:
msg: >-
"This role works best with ansible version 2.4 or greater.
It is recommended to use the latest ansible version for the best experience."
- name: Docker | Include {{ ansible_distribution }} specific variables
include_vars: "ansible_distribution/{{ ansible_distribution.split(' ', 1)[0]|lower }}.yml"
Expand All @@ -25,9 +28,9 @@
- name: Docker | Manage OS not supported by docker-ce
set_fact:
docker_edition: legacy
when: ( ansible_distribution|lower == "centos" and ansible_distribution_major_version == "6" ) or
( ansible_distribution|lower == "redhat" and ansible_distribution_major_version == "6" ) or
( ansible_distribution|lower == "oraclelinux" and ansible_distribution_major_version == "6" )
when: (ansible_distribution|lower == "centos" and ansible_distribution_major_version == "6") or
(ansible_distribution|lower == "redhat" and ansible_distribution_major_version == "6") or
(ansible_distribution|lower == "oraclelinux" and ansible_distribution_major_version == "6")

- name: Docker | Start Installation
include_tasks: "{{ docker_edition }}/{{ ansible_pkg_mgr }}.yml"
Expand All @@ -38,7 +41,9 @@
when: docker_repo == "other"

- name: Docker | Ensure service starts at boot
service: name=docker enabled={{ docker_service_enabled }}
service:
name: docker
enabled: "{{ docker_service_enabled }}"

- name: Docker | Deploy Config
include_tasks: deploy_config.yml
Expand Down
22 changes: 18 additions & 4 deletions tasks/other_repo.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
---
- name: Docker Legacy | Start Installation | Other repo
package: name=docker-engine
when: docker_repo == "other" and docker_edition == "legacy"
package:
name: docker-engine
when:
- docker_repo == "other"
- docker_edition == "legacy"
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: Docker | Start Installation | Other repo
package: name=docker-{{ docker_edition }}
when: docker_repo == "other" and docker_edition != "legacy"
package:
name: "docker-{{ docker_edition }}"
when:
- docker_repo == "other"
- docker_edition != "legacy"
register: task_result
until: task_result is success
retries: 10
delay: 2
4 changes: 4 additions & 0 deletions tasks/storage_drivers/aufs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
when:
- ansible_distribution_version in ['14.04','15.10']
- ansible_distribution == "Ubuntu"
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: Docker | Storage Driver | AUFS | Enable AUFS driver
modprobe:
Expand Down
4 changes: 4 additions & 0 deletions tasks/storage_drivers/btrfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
- name: Docker | Storage Driver | Btrfs | Install Btrfs package
package: name={{ docker_btrfs_package }} state=present
when: ansible_os_family == "Debian"
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: Docker | Storage Driver | Btrfs | Enable btrfs driver
modprobe:
Expand Down
4 changes: 4 additions & 0 deletions tasks/storage_drivers/devicemapper.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
- name: Docker | Storage Driver | devicemapper | Install LVM2
package: name=lvm2 state=present
register: task_result
until: task_result is success
retries: 10
delay: 2

- name: Docker | Storage Driver | devicemapper | Configure logical volume group
lvg:
Expand Down

0 comments on commit 5f039cc

Please sign in to comment.