Skip to content

Commit 9282b6c

Browse files
author
Gpshfrd
committed
with ansible-lint --fix
1 parent 7bb893f commit 9282b6c

12 files changed

Lines changed: 42 additions & 45 deletions

File tree

ansible/playbooks/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
- name: Deploy application
33
hosts: webservers
4-
become: yes
4+
become: true
55
vars_files:
66
- ../group_vars/all.yml
77

88
roles:
9-
- web_app
9+
- web_app

ansible/playbooks/provision.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
- name: Provision web servers
33
hosts: webservers
4-
become: yes
4+
become: true
55

66
roles:
77
- role: common
8-
tags:
8+
tags:
99
- common
1010
- role: docker
1111
tags:
12-
- docker
12+
- docker

ansible/roles/common/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ common_packages:
55
- git
66
- vim
77
- htop
8-
timezone: "Europe/Moscow"
8+
timezone: "Europe/Moscow"

ansible/roles/common/tasks/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
block:
44
- name: Update apt cache
55
apt:
6-
update_cache: yes
6+
update_cache: true
77
cache_valid_time: 3600
88

99
- name: Install common packages
@@ -12,8 +12,8 @@
1212
state: present
1313
rescue:
1414
- name: "Rescue: Fix apt cache issues"
15-
ansible.builtin.apt:
16-
update_cache: yes
15+
ansible.builtin.apt:
16+
update_cache: true
1717
become: true
1818
tags:
1919
- packages
@@ -45,4 +45,4 @@
4545
timezone:
4646
name: "{{ timezone }}"
4747
tags:
48-
- common
48+
- common

ansible/roles/docker/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ docker_packages:
44
- docker-ce-cli
55
- containerd.io
66
docker_user: ubuntu
7-
docker_version: ""
7+
docker_version: ""
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
- name: restart docker
3-
service:
2+
- name: Restart docker
3+
ansible.builtin.service:
44
name: docker
5-
state: restarted
5+
state: restarted

ansible/roles/docker/tasks/main.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,48 @@
66
- docker
77
block:
88
- name: Add Docker GPG key
9-
apt_key:
9+
ansible.builtin.apt_key:
1010
url: https://download.docker.com/linux/ubuntu/gpg
1111
state: present
1212

1313
- name: Add Docker repository
14-
apt_repository:
14+
ansible.builtin.apt_repository:
1515
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
1616
state: present
1717

1818
- name: Install Docker packages
19-
apt:
19+
ansible.builtin.apt:
2020
name:
2121
- docker-ce
2222
- docker-ce-cli
2323
- containerd.io
2424
state: present
25-
update_cache: yes
25+
update_cache: true
2626
rescue:
2727
- name: "Rescue: Retry apt update after GPG key failure"
28-
command: apt-get update --fix-missing
28+
ansible.builtin.command: apt-get update --fix-missing
2929
become: true
3030
always:
3131
- name: "Always: Ensure Docker service is enabled and started"
32-
service:
32+
ansible.builtin.service:
3333
name: docker
3434
state: started
35-
enabled: yes
35+
enabled: true
3636

3737
- name: Docker configuration block
38+
become: true
39+
tags:
40+
- docker_config
41+
- docker
3842
block:
3943
- name: Add user to docker group
40-
user:
44+
ansible.builtin.user:
4145
name: "{{ docker_user }}"
4246
groups: docker
43-
append: yes
47+
append: true
4448

4549
- name: Install python3-docker
46-
pip:
50+
ansible.builtin.pip:
4751
name: docker
4852
state: present
4953
notify: restart docker
50-
become: true
51-
tags:
52-
- docker_config
53-
- docker

ansible/roles/web_app/defaults/main.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ compose_project_dir: "/opt/devops-info-python"
77
docker_image_tag: latest
88
restart_policy: unless-stopped
99
env_vars: {}
10-
11-
web_app_wipe: false # Default: do not wipe
10+
web_app_wipe: false # Default: do not wipe
1211
# Set to true to remove application completely
1312
# Wipe only: ansible-playbook deploy.yml -e "web_app_wipe=true" --tags web_app_wipe
14-
# Clean install: ansible-playbook deploy.yml -e "web_app_wipe=true"
13+
# Clean install: ansible-playbook deploy.yml -e "web_app_wipe=true"
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
2-
- name: restart application container
2+
- name: Restart application container
33
community.docker.docker_container:
44
name: "{{ app_container_name }}"
55
image: "{{ docker_image }}:{{ docker_image_tag }}"
66
state: started
77
restart_policy: "{{ restart_policy }}"
88
published_ports:
99
- "{{ app_port }}:{{ app_port }}"
10-
env:
11-
"{{ env_vars }}"
12-
recreate: yes
10+
env: "{{ env_vars }}"
11+
recreate: true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
---
22
dependencies:
3-
- role: docker
3+
- role: docker

0 commit comments

Comments
 (0)