File tree Expand file tree Collapse file tree
whisperpine/ansitofu/roles Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,13 +3,14 @@ consul_user: "consul"
33consul_group : " consul"
44
55consul_dependencies :
6- - ca-certificates # required by the "ansible.builtin.apt_key" module
7- - gnupg # required by the "ansible.builtin.apt_key " module
6+ - gnupg
7+ - ca-certificates # required by the "ansible.builtin.get_url " module
88 - iproute2 # make the "hostvars[inventory_hostname].ansible_default_ipv4.address" fact be gathered
99
1010# Variables used when installing consul.
1111consul_gpg_url : https://apt.releases.hashicorp.com/gpg
1212consul_repo_url : https://apt.releases.hashicorp.com
13+ consul_key_file : /etc/apt/keyrings/consul.gpg
1314
1415consul_data_dir : " /opt/consul/data"
1516consul_config_dir : " /etc/consul.d"
Original file line number Diff line number Diff line change 2222 shell : /usr/sbin/nologin
2323 system : true
2424
25- - name : Add consul gpg key
26- ansible.builtin.apt_key :
25+ - name : Download consul gpg key
26+ ansible.builtin.get_url :
2727 url : " {{ consul_gpg_url }}"
28- state : present
28+ dest : /tmp/consul.asc
29+ mode : " 0644"
30+
31+ - name : Convert consul gpg key to binary
32+ ansible.builtin.command :
33+ cmd : gpg --dearmor -o "{{ consul_key_file }}" /tmp/consul.asc
34+ creates : " {{ consul_key_file }}"
2935
3036- name : Add HashiCorp apt repository
3137 ansible.builtin.apt_repository :
32- repo : " deb [arch=amd64] {{ consul_repo_url }} {{ ansible_facts['distribution_release'] }} main"
38+ repo : >-
39+ deb [arch=amd64 signed-by={{ consul_key_file }}]
40+ {{ consul_repo_url }} {{ ansible_facts['distribution_release'] }} main
3341 state : present
3442
3543- name : Install consul
Original file line number Diff line number Diff line change @@ -4,18 +4,19 @@ install_docker_arch: amd64
44# Repository URLs.
55install_docker_gpg_url : https://download.docker.com/linux/ubuntu/gpg
66install_docker_repo_url : https://download.docker.com/linux/ubuntu
7+ install_docker_key_file : /etc/apt/keyrings/docker.gpg
78
89# Users to add to the docker group.
910install_docker_users :
1011 - " {{ ansible_facts['user_id'] }}"
1112
1213# Dependencies required for installation.
1314install_docker_dependencies :
14- - apt-transport-https
15+ - gnupg
1516 - ca-certificates
16- - curl
17+ - apt-transport-https
1718 - software-properties-common
18- - gnupg
19+ - curl
1920
2021# Docker packages to install.
2122install_docker_packages :
Original file line number Diff line number Diff line change 1- - name : Update apt package cache
2- ansible.builtin.apt :
3- update_cache : true
4- cache_valid_time : 3600
5- no_log : true
6-
71- name : Install required dependencies
82 ansible.builtin.apt :
93 name : " {{ install_docker_dependencies }}"
104 state : present
5+ update_cache : true
116 no_log : true
127
13- - name : Add Docker GPG key
14- ansible.builtin.apt_key :
8+ - name : Download Docker GPG key
9+ ansible.builtin.get_url :
1510 url : " {{ install_docker_gpg_url }}"
16- state : present
11+ dest : /tmp/docker.asc
12+ mode : " 0644"
13+
14+ - name : Convert Docker GPG key to binary
15+ ansible.builtin.command :
16+ cmd : gpg --dearmor -o "{{ install_docker_key_file }}" /tmp/docker.asc
17+ creates : " {{ install_docker_key_file }}"
1718
1819- name : Add Docker repository
1920 ansible.builtin.apt_repository :
20- repo : " deb [arch={{ install_docker_arch }}] {{ install_docker_repo_url }} {{ ansible_facts['distribution_release'] }} stable"
21+ repo : >-
22+ deb [arch={{ install_docker_arch }} signed-by={{ install_docker_key_file }}]
23+ {{ install_docker_repo_url }}
24+ {{ ansible_facts['distribution_release'] }}
25+ stable
2126 state : present
2227 filename : docker
2328
Original file line number Diff line number Diff line change 11mongodb_dependencies :
2- - ca-certificates # required by the "ansible.builtin.apt_key" module
3- - gnupg # required by the "ansible.builtin.apt_key" module
2+ - ca-certificates # required by the "ansible.builtin.get_url" module
43 - iproute2 # make the "hostvars[inventory_hostname].ansible_default_ipv4.address" fact be gathered
54 - cron # required by the "ansible.builtin.cron" module
65
76mongodb_version : " 8.0"
87mongodb_repo_url : https://repo.mongodb.org/apt/ubuntu
8+ mongodb_key_file : /etc/apt/keyrings/mongodb.asc
99
1010mongodb_port : 27017
1111mongodb_repl_set : rs0
Original file line number Diff line number Diff line change 55 update_cache : true
66 no_log : true
77
8- - name : Add mongodb gpg key
9- ansible.builtin.apt_key :
8+ - name : Download mongodb gpg key
9+ ansible.builtin.get_url :
1010 url : https://pgp.mongodb.com/server-{{ mongodb_version }}.asc
11- state : present
12- no_log : true
11+ dest : " {{ mongodb_key_file }} "
12+ mode : " 0644 "
1313
1414- name : Add mongodb repository
1515 ansible.builtin.apt_repository :
16- repo : " deb [arch=amd64] {{ mongodb_repo_url }} {{ ansible_facts['distribution_release'] }}/mongodb-org/{{ mongodb_version }} multiverse"
16+ repo : >-
17+ deb [arch=amd64 signed-by={{ mongodb_key_file }}]
18+ {{ mongodb_repo_url }}
19+ {{ ansible_facts['distribution_release'] }}/mongodb-org/{{ mongodb_version }}
20+ multiverse
1721 state : present
1822
1923- name : Install mongodb
You can’t perform that action at this time.
0 commit comments