Skip to content

Commit

Permalink
Merge pull request #180 from konstruktoid/lint
Browse files Browse the repository at this point in the history
lint write
  • Loading branch information
konstruktoid authored Jul 7, 2023
2 parents 67434bb + fb00566 commit 0c14aa9
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 85 deletions.
13 changes: 6 additions & 7 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
# https://github.com/docker/roadmap/issues/188
# https://download.docker.com/linux/static/stable/x86_64/{docker,docker-rootless-extras}-24.0.3.tgz
docker_add_alias: true
docker_release: "24.0.3"
docker_release_shasum: "f7bcb029ecb061ed3d647a8fe793b9db26c1a0526716525d6632cc79ee805bcb"
docker_release_rootless_shasum: "dce01e1c7df0c791dd3ac42d34ac34e8b3e984341e162458e8c36a5ca8caeef5"
docker_bash_completion_shasum: "cd9c70120bc5f7e6772b6a5350abf63099004c357814abc8a8a3689a7f2e3df0"
docker_compose_bash_completion_shasum: "9926c945b466fad570ad574089d6a90f7d9ba452a2d6a8ba67611a664707f0de"
docker_release: 24.0.3
docker_release_shasum: f7bcb029ecb061ed3d647a8fe793b9db26c1a0526716525d6632cc79ee805bcb
docker_release_rootless_shasum: dce01e1c7df0c791dd3ac42d34ac34e8b3e984341e162458e8c36a5ca8caeef5
docker_bash_completion_shasum: cd9c70120bc5f7e6772b6a5350abf63099004c357814abc8a8a3689a7f2e3df0
docker_compose_bash_completion_shasum: 9926c945b466fad570ad574089d6a90f7d9ba452a2d6a8ba67611a664707f0de
docker_rootful: false
docker_rootful_enabled: false
docker_rootful_opts: >
--live-restore --icc=false --default-ulimit nproc=512:1024 --default-ulimit nofile=100:200 -H fd://
docker_url: "https://download.docker.com/linux/static/stable/x86_64"
docker_url: https://download.docker.com/linux/static/stable/x86_64
docker_user: dockeruser
docker_user_bashrc: false
docker_allow_privileged_ports: false
docker_allow_ping: false
docker_compose: false
docker_service_restart: true
...
1 change: 0 additions & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
state: restarted
scope: user
when: docker_service_restart
...
2 changes: 1 addition & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
hosts: all
any_errors_fatal: true
tasks:
- name: "Include Ansible role"
- name: Include Ansible role
ansible.builtin.include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
48 changes: 24 additions & 24 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,76 +85,76 @@ provisioner:
docker_compose: false
platforms:
- name: bullseye
box: "debian/bullseye64"
box: debian/bullseye64
config_options:
vm.boot_timeout: 600
provider_raw_config_args:
- "customize ['modifyvm', :id, '--natdnshostresolver1', 'on']"
- customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
instance_raw_config_args:
- 'vbguest.auto_update = false'
- vbguest.auto_update = false
memory: 1024
- name: debiantesting
box: "debian/testing64"
box: debian/testing64
config_options:
vm.boot_timeout: 600
provider_raw_config_args:
- "customize ['modifyvm', :id, '--natdnshostresolver1', 'on']"
- customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
instance_raw_config_args:
- 'vbguest.auto_update = false'
- vbguest.auto_update = false
memory: 1024
- name: almalinux8
box: "almalinux/8"
box: almalinux/8
config_options:
vm.boot_timeout: 600
provider_raw_config_args:
- "customize ['modifyvm', :id, '--natdnshostresolver1', 'on']"
- customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
instance_raw_config_args:
- 'vbguest.auto_update = false'
- vbguest.auto_update = false
memory: 1024
- name: almalinux9
box: "almalinux/9"
box: almalinux/9
config_options:
vm.boot_timeout: 600
provider_raw_config_args:
- "customize ['modifyvm', :id, '--natdnshostresolver1', 'on']"
- customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
instance_raw_config_args:
- 'vbguest.auto_update = false'
- vbguest.auto_update = false
memory: 1024
- name: focal
box: "bento/ubuntu-20.04"
box: bento/ubuntu-20.04
config_options:
vm.boot_timeout: 600
instance_raw_config_args:
- 'vbguest.installer_options = { allow_kernel_upgrade: true }'
- "vbguest.installer_options = { allow_kernel_upgrade: true }"
memory: 1024
- name: focalroot
box: "bento/ubuntu-20.04"
box: bento/ubuntu-20.04
config_options:
vm.boot_timeout: 600
instance_raw_config_args:
- 'vbguest.installer_options = { allow_kernel_upgrade: true }'
- "vbguest.installer_options = { allow_kernel_upgrade: true }"
memory: 1024
- name: jammy
box: "ubuntu/jammy64"
box: ubuntu/jammy64
config_options:
vm.boot_timeout: 600
synced_folder: false
provider_raw_config_args:
- "customize ['modifyvm', :id, '--uart1', '0x3F8', '4']"
- "customize ['modifyvm', :id, '--uartmode1', 'file', File::NULL]"
- customize ['modifyvm', :id, '--uart1', '0x3F8', '4']
- customize ['modifyvm', :id, '--uartmode1', 'file', File::NULL]
instance_raw_config_args:
- 'vbguest.installer_options = { allow_kernel_upgrade: true }'
- "vbguest.installer_options = { allow_kernel_upgrade: true }"
memory: 1024
- name: lunar
box: "ubuntu/lunar64"
box: ubuntu/lunar64
config_options:
vm.boot_timeout: 600
synced_folder: false
provider_raw_config_args:
- "customize ['modifyvm', :id, '--uart1', '0x3F8', '4']"
- "customize ['modifyvm', :id, '--uartmode1', 'file', File::NULL]"
- customize ['modifyvm', :id, '--uart1', '0x3F8', '4']
- customize ['modifyvm', :id, '--uartmode1', 'file', File::NULL]
instance_raw_config_args:
- 'vbguest.installer_options = { allow_kernel_upgrade: true }'
- "vbguest.installer_options = { allow_kernel_upgrade: true }"
memory: 1024
verifier:
name: ansible
Expand Down
16 changes: 7 additions & 9 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ansible.builtin.include_vars:
dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/defaults/"
extensions:
- 'yml'
- yml

- name: Include host vars
ansible.builtin.include_vars:
Expand Down Expand Up @@ -154,18 +154,17 @@

- name: Container verification block
environment:
XDG_RUNTIME_DIR: "/run/user/{{ docker_user_info.uid }}"
XDG_RUNTIME_DIR: /run/user/{{ docker_user_info.uid }}
PATH: "{{ docker_user_info.home }}/bin:{{ ansible_env.PATH }}"
DOCKER_HOST: "unix:///run/user/{{ docker_user_info.uid }}/docker.sock"
DOCKER_HOST: unix:///run/user/{{ docker_user_info.uid }}/docker.sock
block:
- name: Reboot host
become: true
ansible.builtin.reboot:

- name: Wait for the host and reconnect
ansible.builtin.wait_for:
port: 22
host: '{{ (ansible_ssh_host | default(ansible_host)) | default(inventory_hostname) }}'
host: "{{ (ansible_ssh_host | default(ansible_host)) | default(inventory_hostname) }}"
delay: 10
timeout: 120

Expand All @@ -187,7 +186,7 @@
image: konstruktoid/nginx
state: started
ports:
- "8080:80"
- 8080:80
cap_drop: all
capabilities:
- chown
Expand Down Expand Up @@ -258,7 +257,7 @@
state: started
restart: true
ports:
- "8081:80"
- 8081:80
cap_drop: all
capabilities:
- chown
Expand Down Expand Up @@ -294,7 +293,7 @@
state: started
restart: true
ports:
- "80:80"
- 80:80
cap_drop: all
capabilities:
- chown
Expand Down Expand Up @@ -339,4 +338,3 @@
register: published
failed_when: "'nginx' not in published.content"
when: docker_allow_privileged_ports | bool
...
1 change: 0 additions & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ collections:
- ansible.posix
- community.docker
- community.general
...
8 changes: 4 additions & 4 deletions tasks/bashrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@
become: true
become_user: "{{ docker_user }}"
ansible.builtin.get_url:
url: "https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker"
url: https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker
dest: "{{ docker_user_info.home }}/.bash_completion.d/"
checksum: "sha256:{{ docker_bash_completion_shasum }}"
checksum: sha256:{{ docker_bash_completion_shasum }}
mode: "0644"

- name: Install docker-compose bash completion
become: true
become_user: "{{ docker_user }}"
ansible.builtin.get_url:
url: "https://raw.githubusercontent.com/docker/compose/1.29.2/contrib/completion/bash/docker-compose"
url: https://raw.githubusercontent.com/docker/compose/1.29.2/contrib/completion/bash/docker-compose
dest: "{{ docker_user_info.home }}/.bash_completion.d/"
checksum: "sha256:{{ docker_compose_bash_completion_shasum }}"
checksum: sha256:{{ docker_compose_bash_completion_shasum }}
mode: "0644"
when: docker_compose
11 changes: 5 additions & 6 deletions tasks/docker_install_rootful.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Update facts
ansible.builtin.setup: ~
ansible.builtin.setup:
tags:
- fact

Expand All @@ -13,7 +13,7 @@
- name: Import Docker gpg key
become: true
ansible.builtin.get_url:
url: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg"
url: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg
dest: /etc/apt/trusted.gpg.d/docker.asc
mode: "0644"
force: true
Expand Down Expand Up @@ -41,13 +41,13 @@
block:
- name: Stat docker-ce.repo file
ansible.builtin.stat:
path: "/etc/yum.repos.d/docker-ce.repo"
path: /etc/yum.repos.d/docker-ce.repo
register: docker_ce_repo

- name: Add Docker yum repo
become: true
ansible.builtin.command:
cmd: "dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo"
cmd: dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
register: add_yum_repo
changed_when: add_yum_repo.rc != 0
failed_when: add_yum_repo.rc != 0
Expand All @@ -56,10 +56,9 @@
- name: Install Docker
become: true
ansible.builtin.package:
name: ['docker-ce', 'docker-ce-rootless-extras']
name: [docker-ce, docker-ce-rootless-extras]
state: present
tags:
- apt
- dnf
- docker
...
9 changes: 4 additions & 5 deletions tasks/docker_install_rootless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@
- docker
when: docker_release not in rootless_docker_version.stdout
block:
- name: "Download Docker archive {{ docker_release }}"
- name: Download Docker archive {{ docker_release }}
become: true
become_user: "{{ docker_user }}"
ansible.builtin.get_url:
url: "{{ docker_url }}/docker-{{ docker_release }}.tgz"
dest: "{{ docker_user_info.home }}/docker-{{ docker_release }}.tgz"
checksum: "sha256:{{ docker_release_shasum }}"
checksum: sha256:{{ docker_release_shasum }}
owner: "{{ docker_user }}"
mode: "0644"

- name: "Download docker-rootless-extras archive {{ docker_release }}"
- name: Download docker-rootless-extras archive {{ docker_release }}
become: true
become_user: "{{ docker_user }}"
ansible.builtin.get_url:
url: "{{ docker_url }}/docker-rootless-extras-{{ docker_release }}.tgz"
dest: "{{ docker_user_info.home }}/docker-rootless-extras-{{ docker_release }}.tgz"
checksum: "sha256:{{ docker_release_rootless_shasum }}"
checksum: sha256:{{ docker_release_rootless_shasum }}
owner: "{{ docker_user }}"
mode: "0644"

Expand Down Expand Up @@ -100,4 +100,3 @@
tags:
- docker
- systemd
...
5 changes: 2 additions & 3 deletions tasks/docker_service_rootful.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
become: true
become_user: "{{ docker_user }}"
ansible.builtin.stat:
path: "/run/user/{{ docker_user_info.uid }}/docker.sock"
path: /run/user/{{ docker_user_info.uid }}/docker.sock
register: docker_rootless_sock
tags:
- docker
Expand All @@ -55,7 +55,7 @@
become_user: "{{ docker_user }}"
environment:
PATH: "{{ docker_user_info.home }}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
XDG_RUNTIME_DIR: "/run/user/{{ docker_user_info.uid }}"
XDG_RUNTIME_DIR: /run/user/{{ docker_user_info.uid }}
ansible.builtin.command:
cmd: dockerd-rootless-setuptool.sh install
register: install_rootless_docker
Expand All @@ -75,4 +75,3 @@
tags:
- docker
- systemd
...
11 changes: 5 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

- name: Rootful Docker block
environment:
XDG_RUNTIME_DIR: "/run/user/{{ docker_user_info.uid }}"
XDG_RUNTIME_DIR: /run/user/{{ docker_user_info.uid }}
PATH: "{{ docker_user_info.home }}/bin:{{ ansible_env.PATH }}"
DOCKER_HOST: "unix:///run/user/{{ docker_user_info.uid }}/docker.sock"
DOCKER_HOST: unix:///run/user/{{ docker_user_info.uid }}/docker.sock
when: docker_rootful and not (ansible_distribution == "Debian" and ansible_distribution_major_version <= '10')
block:
- name: Install rootful Docker
Expand All @@ -25,7 +25,7 @@

- name: Debian information
ansible.builtin.fail:
msg: "slirp4netns (>= 0.4.0) is required, currently not available in Debian <= 10"
msg: slirp4netns (>= 0.4.0) is required, currently not available in Debian <= 10
when: docker_rootful and (ansible_distribution == "Debian" and ansible_distribution_major_version <= '10')

- name: Install and configure rootless docker
Expand Down Expand Up @@ -71,7 +71,7 @@
ansible.builtin.lineinfile:
path: "{{ ansible_env.HOME }}/.bash_aliases"
line: "{{ sudo_alias }}"
regexp: '^alias docker='
regexp: ^alias docker=
state: present
create: true
mode: "0640"
Expand All @@ -81,7 +81,7 @@
ansible.builtin.lineinfile:
path: "{{ ansible_env.HOME }}/.bashrc"
line: "{{ sudo_alias }}"
regexp: '^alias docker='
regexp: ^alias docker=
when: user_bashrc.stat.exists and check_aliases.rc != 0 and not docker_rootful

- name: Create docker_rootless.sh
Expand All @@ -94,4 +94,3 @@
- name: Deploy bash completion
ansible.builtin.include_tasks: bashrc.yml
when: docker_user_bashrc
...
5 changes: 2 additions & 3 deletions tasks/manage_user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

- name: Ensure Docker user is lingering
ansible.builtin.stat:
path: "/var/lib/systemd/linger/{{ docker_user }}"
path: /var/lib/systemd/linger/{{ docker_user }}
register: docker_user_lingering
tags:
- user
Expand All @@ -30,7 +30,7 @@
- name: Enable lingering for the Docker user
become: true
ansible.builtin.command:
cmd: "loginctl enable-linger {{ docker_user }}"
cmd: loginctl enable-linger {{ docker_user }}
register: enable_lingering
changed_when: enable_lingering.rc != 0
failed_when: enable_lingering.rc != 0
Expand All @@ -48,4 +48,3 @@
mode: "0700"
tags:
- user
...
Loading

0 comments on commit 0c14aa9

Please sign in to comment.