mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-07-02 07:48:32 +02:00
Compare commits
8 Commits
9871b8cb29
...
d255ad37ad
Author | SHA1 | Date | |
---|---|---|---|
d255ad37ad | |||
89030dec11 | |||
6df5f17cfe | |||
ff8ebb3940 | |||
6a720e2e89 | |||
02dc0134c4 | |||
e7fb37545f | |||
5927ad571e |
@ -4,93 +4,86 @@
|
|||||||
- name: Facts
|
- name: Facts
|
||||||
ansible.builtin.setup:
|
ansible.builtin.setup:
|
||||||
|
|
||||||
# - name: Print arch
|
- name: Print arch
|
||||||
# ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
# msg: "{{ ansible_architecture }}"
|
msg: "{{ ansible_architecture }}"
|
||||||
# - name: Install docker dependencies
|
- name: Install docker dependencies
|
||||||
# ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
# name:
|
name:
|
||||||
# - ca-certificates
|
- ca-certificates
|
||||||
# - curl
|
- curl
|
||||||
# - telnet
|
- telnet
|
||||||
# - net-tools
|
- net-tools
|
||||||
# - python3-pip
|
- python3-pip
|
||||||
# - python3-dev
|
- python3-dev
|
||||||
# state: present
|
state: present
|
||||||
# update_cache: true
|
update_cache: true
|
||||||
# - name: Get keys for raspotify
|
- name: Get keys for raspotify
|
||||||
# ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
# install -m 0755 -d /etc/apt/keyrings
|
install -m 0755 -d /etc/apt/keyrings
|
||||||
|
|
||||||
|
|
||||||
# # - name: Add an Apt signing key to a specific keyring file
|
|
||||||
# # ansible.builtin.apt_key:
|
|
||||||
# # url: https://download.docker.com/linux/debian/gpg
|
|
||||||
# # keyring: /etc/apt/keyrings/docker.asc
|
|
||||||
# # when:
|
|
||||||
# # - ansible_distribution == "Debian" and ansible_distribution_major_version == "12"
|
|
||||||
|
|
||||||
# # - name: Get keys for raspotify
|
|
||||||
# # ansible.builtin.shell:
|
|
||||||
# # curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
|
||||||
# # when:
|
|
||||||
# # - ansible_distribution == "Debian" and ansible_distribution_major_version == "12"
|
|
||||||
|
|
||||||
# - name: Get keys for raspotify
|
|
||||||
# ansible.builtin.shell:
|
|
||||||
# curl -fsSL https://download.docker.com/linux/raspbian/gpg -o /etc/apt/keyrings/docker.asc
|
|
||||||
# when:
|
|
||||||
# - ansible_distribution == "Debian" and ansible_distribution_major_version == "12"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# - name: Add an Apt signing key to a specific keyring file
|
# - name: Add an Apt signing key to a specific keyring file
|
||||||
# ansible.builtin.apt_key:
|
# ansible.builtin.apt_key:
|
||||||
# url: https://download.docker.com/linux/ubuntu/gpg
|
# url: https://download.docker.com/linux/debian/gpg
|
||||||
# keyring: /etc/apt/keyrings/docker.asc
|
# keyring: /etc/apt/keyrings/docker.asc
|
||||||
# when:
|
# when:
|
||||||
# - ansible_distribution == "Ubuntu"
|
|
||||||
|
|
||||||
# # - name: Get keys for raspotify
|
|
||||||
# # ansible.builtin.shell:
|
|
||||||
# # curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
|
||||||
# # when:
|
|
||||||
# # - ansible_distribution == "Ubuntu"
|
|
||||||
# - name: Change file ownership, group and permissions
|
|
||||||
# ansible.builtin.file:
|
|
||||||
# path: /etc/apt/keyrings/docker.asc
|
|
||||||
# owner: root
|
|
||||||
# group: root
|
|
||||||
# mode: '0644'
|
|
||||||
|
|
||||||
# # - name: Get keys for raspotify
|
|
||||||
# # ansible.builtin.shell:
|
|
||||||
# # chmod a+r /etc/apt/keyrings/docker.asc
|
|
||||||
|
|
||||||
# - name: Get keys for raspotify
|
|
||||||
# ansible.builtin.shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc]\
|
|
||||||
# https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" |\
|
|
||||||
# tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
||||||
# when:
|
|
||||||
# - ansible_distribution == "Debian" and ansible_distribution_major_version == "12"
|
# - ansible_distribution == "Debian" and ansible_distribution_major_version == "12"
|
||||||
|
|
||||||
# - name: Get keys for raspotify
|
# - name: Get keys for raspotify
|
||||||
# ansible.builtin.shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc]\
|
# ansible.builtin.shell:
|
||||||
# https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" |\
|
# curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
||||||
# sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
# when:
|
||||||
|
# - ansible_distribution == "Debian" and ansible_distribution_major_version == "12"
|
||||||
|
|
||||||
|
- name: Get keys for raspotify
|
||||||
|
ansible.builtin.shell:
|
||||||
|
curl -fsSL https://download.docker.com/linux/raspbian/gpg -o /etc/apt/keyrings/docker.asc
|
||||||
|
when:
|
||||||
|
- ansible_distribution == "Debian" and ansible_distribution_major_version == "12"
|
||||||
|
|
||||||
|
- name: Add an Apt signing key to a specific keyring file
|
||||||
|
ansible.builtin.apt_key:
|
||||||
|
url: https://download.docker.com/linux/ubuntu/gpg
|
||||||
|
keyring: /etc/apt/keyrings/docker.asc
|
||||||
|
when:
|
||||||
|
- ansible_distribution == "Ubuntu"
|
||||||
|
|
||||||
|
# - name: Get keys for raspotify
|
||||||
|
# ansible.builtin.shell:
|
||||||
|
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
||||||
# when:
|
# when:
|
||||||
# - ansible_distribution == "Ubuntu"
|
# - ansible_distribution == "Ubuntu"
|
||||||
|
- name: Change file ownership, group and permissions
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/apt/keyrings/docker.asc
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
# - name: Install docker
|
# - name: Get keys for raspotify
|
||||||
# ansible.builtin.apt:
|
# ansible.builtin.shell:
|
||||||
# name:
|
# chmod a+r /etc/apt/keyrings/docker.asc
|
||||||
# - docker-ce
|
|
||||||
# - docker-ce-cli
|
- name: Get keys for raspotify
|
||||||
# - containerd.io
|
ansible.builtin.shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
# - docker-buildx-plugin
|
when:
|
||||||
# - docker-compose-plugin
|
- ansible_distribution == "Debian" and ansible_distribution_major_version == "12"
|
||||||
# update_cache: true
|
|
||||||
|
- name: Get keys for raspotify
|
||||||
|
ansible.builtin.shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
|
when:
|
||||||
|
- ansible_distribution == "Ubuntu"
|
||||||
|
|
||||||
|
- name: Install docker
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- docker-ce
|
||||||
|
- docker-ce-cli
|
||||||
|
- containerd.io
|
||||||
|
- docker-buildx-plugin
|
||||||
|
- docker-compose-plugin
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
- name: Create a directory docker.service.d
|
- name: Create a directory docker.service.d
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
@ -132,14 +125,12 @@
|
|||||||
content: |
|
content: |
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=
|
ExecStart=
|
||||||
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --tlsverify \
|
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --tlsverify --tlscacert=/etc/docker/certs/ca.pem --tlscert=/etc/docker/certs/server-cert.pem --tlskey=/etc/docker/certs/server-key.pem -H=0.0.0.0:2376
|
||||||
--tlscacert=/etc/docker/certs/ca.pem --tlscert=/etc/docker/certs/server-cert.pem \
|
|
||||||
--tlskey=/etc/docker/certs/server-key.pem -H=0.0.0.0:2376
|
|
||||||
mode: '0600'
|
mode: '0600'
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
notify: restart_docker
|
notify: restart_docker
|
||||||
when: mode == "nocert"
|
when: mode == "cert"
|
||||||
|
|
||||||
# - name: Creating a file with content
|
# - name: Creating a file with content
|
||||||
# ansible.builtin.copy:
|
# ansible.builtin.copy:
|
||||||
|
@ -20,7 +20,21 @@
|
|||||||
- name: Print message
|
- name: Print message
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "{{ inventory_hostname }}"
|
msg: "{{ inventory_hostname }}"
|
||||||
|
- name: Create dir
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/mqtt_srv/
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
- name: Create dir
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /myapps/mqtt_srv/
|
||||||
|
recurse: true
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
- name: Upload service config
|
- name: Upload service config
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "{{ dest_folder }}/mqtt_srv.service"
|
src: "{{ dest_folder }}/mqtt_srv.service"
|
||||||
@ -48,21 +62,8 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
remote_src: true
|
remote_src: true
|
||||||
when: inventory_hostname != 'nas.home.lan'
|
when: inventory_hostname != 'nas.home.lan'
|
||||||
- name: Create dir
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: /etc/mqtt_srv/
|
|
||||||
state: directory
|
|
||||||
mode: '0755'
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
- name: Create dir
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: /myapps/mqtt_srv/
|
|
||||||
state: directory
|
|
||||||
mode: '0755'
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
|
|
||||||
- name: Upload service script config
|
- name: Upload service script config
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
|
@ -73,10 +73,17 @@
|
|||||||
- zabbix-agent2-plugin-postgresql
|
- zabbix-agent2-plugin-postgresql
|
||||||
# - zabbix-agent2-plugin-mysql
|
# - zabbix-agent2-plugin-mysql
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
when: inventory_hostname != 'nas.home.lan'
|
||||||
|
- name: Install zabbix packages
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name:
|
||||||
|
- zabbix-agent2
|
||||||
|
- zabbix-agent2-plugin-mongodb
|
||||||
|
- zabbix-agent2-plugin-postgresql
|
||||||
|
# - zabbix-agent2-plugin-mysql
|
||||||
only_upgrade: true
|
only_upgrade: true
|
||||||
when: inventory_hostname != 'nas.home.lan'
|
when: inventory_hostname != 'nas.home.lan'
|
||||||
|
|
||||||
|
|
||||||
- name: Reconfigure zabbix agent Server
|
- name: Reconfigure zabbix agent Server
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "{{ zabbix_agent_cfg }}"
|
path: "{{ zabbix_agent_cfg }}"
|
||||||
|
Reference in New Issue
Block a user