do_become

This commit is contained in:
Roxedus 2022-10-19 00:16:16 +02:00
parent 0a3ffc4bdd
commit 985ae6be37
Signed by: Roxedus
GPG Key ID: 9B4E311961C63639
12 changed files with 45 additions and 45 deletions

View File

@ -1,7 +1,7 @@
--- ---
# credit: https://johnscs.com/remove-proxmox51-subscription-notice/ & https://github.com/foundObjects/pve-nag-buster # credit: https://johnscs.com/remove-proxmox51-subscription-notice/ & https://github.com/foundObjects/pve-nag-buster
- name: Modify line in file to remove nag message - name: Modify line in file to remove nag message
become: true become: "{{ do_become }}"
replace: replace:
path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
regexp: 'res === null \|\| res === undefined \|\| !res \|\| res[\s\n]*\.data\.status\.toLowerCase\(\) !== .active.' regexp: 'res === null \|\| res === undefined \|\| !res \|\| res[\s\n]*\.data\.status\.toLowerCase\(\) !== .active.'

View File

@ -1,5 +1,5 @@
- name: kube | systemctl restart systemd-modules-load.service - name: kube | systemctl restart systemd-modules-load.service
become: true become: "{{ do_become }}"
ansible.builtin.service: ansible.builtin.service:
name: "systemd-modules-load.service" name: "systemd-modules-load.service"
state: "restarted" state: "restarted"
@ -7,7 +7,7 @@
failed_when: false failed_when: false
- name: kube | docker options changed - name: kube | docker options changed
become: true become: "{{ do_become }}"
ansible.builtin.service: ansible.builtin.service:
name: "docker.service" name: "docker.service"
state: "restarted" state: "restarted"
@ -15,13 +15,13 @@
failed_when: false failed_when: false
- name: kube | sysctl --system - name: kube | sysctl --system
become: true become: "{{ do_become }}"
ansible.builtin.command: sysctl --system ansible.builtin.command: sysctl --system
changed_when: false changed_when: false
failed_when: false failed_when: false
- name: kube | boot options changed - name: kube | boot options changed
become: true become: "{{ do_become }}"
changed_when: false changed_when: false
failed_when: false failed_when: false
ansible.builtin.reboot: ansible.builtin.reboot:

View File

@ -1,5 +1,5 @@
- name: Install kubectl - name: Install kubectl
become: true become: "{{ do_become }}"
ansible.builtin.apt: ansible.builtin.apt:
name: "{{ item }}={{ kube_apt }}" name: "{{ item }}={{ kube_apt }}"
state: present state: present
@ -7,7 +7,7 @@
- kubectl - kubectl
- name: Hold kubectl version - name: Hold kubectl version
become: true become: "{{ do_become }}"
ansible.builtin.dpkg_selections: ansible.builtin.dpkg_selections:
name: "{{ item }}" name: "{{ item }}"
selection: "hold" selection: "hold"

View File

@ -1,11 +1,11 @@
- name: Disable SWAP - name: Disable SWAP
when: ansible_memory_mb.swap.total != 0 when: ansible_memory_mb.swap.total != 0
register: swap_disable register: swap_disable
become: true become: "{{ do_become }}"
ansible.builtin.command: swapoff -a ansible.builtin.command: swapoff -a
- name: Remove swapfile from /etc/fstab - name: Remove swapfile from /etc/fstab
become: true become: "{{ do_become }}"
ansible.posix.mount: ansible.posix.mount:
name: "{{ item }}" name: "{{ item }}"
fstype: swap fstype: swap
@ -14,7 +14,7 @@
- swap - swap
- name: Add propogation to systemd - name: Add propogation to systemd
become: true become: "{{ do_become }}"
community.general.ini_file: community.general.ini_file:
path: /lib/systemd/system/docker.service path: /lib/systemd/system/docker.service
section: Service section: Service
@ -26,7 +26,7 @@
- name: Set up kmsg in LXC # https://kevingoos.medium.com/kubernetes-inside-proxmox-lxc-cce5c9927942 - name: Set up kmsg in LXC # https://kevingoos.medium.com/kubernetes-inside-proxmox-lxc-cce5c9927942
when: inventory_hostname in groups['lxc_guest'] when: inventory_hostname in groups['lxc_guest']
become: true become: "{{ do_become }}"
ansible.builtin.copy: ansible.builtin.copy:
content: | content: |
#!/bin/sh -e #!/bin/sh -e
@ -63,7 +63,7 @@
- kube | boot options changed - kube | boot options changed
- name: Tweak modeprobe entries - name: Tweak modeprobe entries
become: true become: "{{ do_become }}"
ansible.builtin.ini_file: ansible.builtin.ini_file:
option: "{{ item.option }}" option: "{{ item.option }}"
state: "{{ item.state }}" state: "{{ item.state }}"
@ -78,7 +78,7 @@
- kube | systemctl restart systemd-modules-load.service - kube | systemctl restart systemd-modules-load.service
- name: Tweak sysctl entries - name: Tweak sysctl entries
become: true become: "{{ do_become }}"
ansible.builtin.sysctl: ansible.builtin.sysctl:
name: "{{ item.name }}" name: "{{ item.name }}"
value: "{{ item.value }}" value: "{{ item.value }}"
@ -117,7 +117,7 @@
- kube | sysctl --system - kube | sysctl --system
- name: Add Apt signing key for Google and Libcontainers - name: Add Apt signing key for Google and Libcontainers
become: true become: "{{ do_become }}"
ansible.builtin.apt_key: ansible.builtin.apt_key:
url: "{{ item }}" url: "{{ item }}"
state: present state: present
@ -125,7 +125,7 @@
- https://packages.cloud.google.com/apt/doc/apt-key.gpg - https://packages.cloud.google.com/apt/doc/apt-key.gpg
- name: Add repo for Google and Libcontainers - name: Add repo for Google and Libcontainers
become: true become: "{{ do_become }}"
ansible.builtin.apt_repository: ansible.builtin.apt_repository:
filename: Kubernetes filename: Kubernetes
repo: "deb {{ item }}" repo: "deb {{ item }}"
@ -135,7 +135,7 @@
- https://apt.kubernetes.io/ kubernetes-xenial main - https://apt.kubernetes.io/ kubernetes-xenial main
- name: Install kubernetes packages - name: Install kubernetes packages
become: true become: "{{ do_become }}"
ansible.builtin.apt: ansible.builtin.apt:
name: "{{ item }}={{ kube_apt }}" name: "{{ item }}={{ kube_apt }}"
state: present state: present
@ -144,7 +144,7 @@
- kubeadm - kubeadm
- name: Hold kubernetes version - name: Hold kubernetes version
become: true become: "{{ do_become }}"
when: ! is_controlplane is defined when: ! is_controlplane is defined
ansible.builtin.dpkg_selections: ansible.builtin.dpkg_selections:
name: "{{ item }}" name: "{{ item }}"

View File

@ -5,7 +5,7 @@
- name: Set up dnsmasq hosts - name: Set up dnsmasq hosts
register: dnsmasq_hosts register: dnsmasq_hosts
become: true become: "{{ do_become }}"
ansible.builtin.template: ansible.builtin.template:
src: hosts.custom.j2 src: hosts.custom.j2
group: root group: root
@ -16,7 +16,7 @@
- name: Set up dnsmasq rules - name: Set up dnsmasq rules
when: dnsmasq_setup.stat.isdir is defined and dnsmasq_setup.stat.isdir when: dnsmasq_setup.stat.isdir is defined and dnsmasq_setup.stat.isdir
register: dnsmasq register: dnsmasq
become: true become: "{{ do_become }}"
ansible.builtin.template: ansible.builtin.template:
src: 02-custom.conf.j2 src: 02-custom.conf.j2
group: root group: root
@ -31,7 +31,7 @@
- name: Restart PiHole systems - name: Restart PiHole systems
when: (dnsmasq.changed or dnsmasq_hosts.changed) and pihole_bin.stat.exists when: (dnsmasq.changed or dnsmasq_hosts.changed) and pihole_bin.stat.exists
become: true become: "{{ do_become }}"
ansible.builtin.command: ansible.builtin.command:
argv: argv:
- pihole - pihole

View File

@ -1,5 +1,5 @@
- name: Set pihole webpassword - name: Set pihole webpassword
become: true become: "{{ do_become }}"
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/pihole/setupVars.conf path: /etc/pihole/setupVars.conf
regexp: "^WEBPASSWORD=" regexp: "^WEBPASSWORD="
@ -7,7 +7,7 @@
create: yes create: yes
- name: Set pihole theme - name: Set pihole theme
become: true become: "{{ do_become }}"
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/pihole/setupVars.conf path: /etc/pihole/setupVars.conf
regexp: "^WEBTHEME=" regexp: "^WEBTHEME="
@ -15,7 +15,7 @@
create: yes create: yes
- name: Set pihole layout - name: Set pihole layout
become: true become: "{{ do_become }}"
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/pihole/setupVars.conf path: /etc/pihole/setupVars.conf
regexp: "^WEBUIBOXEDLAYOUT=" regexp: "^WEBUIBOXEDLAYOUT="
@ -23,7 +23,7 @@
create: yes create: yes
- name: Set pihole listen - name: Set pihole listen
become: true become: "{{ do_become }}"
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/pihole/setupVars.conf path: /etc/pihole/setupVars.conf
regexp: "^DNSMASQ_LISTENING=" regexp: "^DNSMASQ_LISTENING="
@ -31,7 +31,7 @@
create: yes create: yes
- name: Set pihole fqdn forwarding - name: Set pihole fqdn forwarding
become: true become: "{{ do_become }}"
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/pihole/setupVars.conf path: /etc/pihole/setupVars.conf
regexp: "^DNS_FQDN_REQUIRED=" regexp: "^DNS_FQDN_REQUIRED="
@ -39,7 +39,7 @@
create: yes create: yes
- name: Set pihole reverse lookup - name: Set pihole reverse lookup
become: true become: "{{ do_become }}"
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/pihole/setupVars.conf path: /etc/pihole/setupVars.conf
regexp: "^DNS_BOGUS_PRIV=" regexp: "^DNS_BOGUS_PRIV="
@ -47,7 +47,7 @@
create: yes create: yes
- name: Set pihole iCloud relay - name: Set pihole iCloud relay
become: true become: "{{ do_become }}"
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/pihole/setupVars.conf path: /etc/pihole/setupVars.conf
regexp: "^BLOCK_ICLOUD_PR=" regexp: "^BLOCK_ICLOUD_PR="

View File

@ -1,6 +1,6 @@
- name: Get dependencies for PiHole - name: Get dependencies for PiHole
when: not pihole_setup.stat.exists when: not pihole_setup.stat.exists
become: true become: "{{ do_become }}"
ansible.builtin.apt: ansible.builtin.apt:
name: name:
[ [
@ -34,7 +34,7 @@
state: latest state: latest
- name: Checkout PiHole - name: Checkout PiHole
become: true become: "{{ do_become }}"
ansible.builtin.git: ansible.builtin.git:
repo: "https://github.com/pi-hole/pi-hole.git" repo: "https://github.com/pi-hole/pi-hole.git"
clone: yes clone: yes

View File

@ -14,7 +14,7 @@
mode: "0644" mode: "0644"
owner: "root" owner: "root"
group: "root" group: "root"
become: true become: "{{ do_become }}"
- name: Check if updatelist is installed - name: Check if updatelist is installed
ansible.builtin.stat: ansible.builtin.stat:
@ -23,7 +23,7 @@
- name: Activate changes - name: Activate changes
when: updatelist_exec.stat.exists when: updatelist_exec.stat.exists
become: true become: "{{ do_become }}"
ansible.builtin.command: ansible.builtin.command:
argv: argv:
- pihole-updatelists - pihole-updatelists

View File

@ -1,5 +1,5 @@
- name: Install packages - name: Install packages
become: true become: "{{ do_become }}"
ansible.builtin.apt: ansible.builtin.apt:
name: "{{ item }}={{ zfs_ver }}" name: "{{ item }}={{ zfs_ver }}"
state: present state: present
@ -7,7 +7,7 @@
- zfsutils-linux - zfsutils-linux
- name: Hold ZFS version - name: Hold ZFS version
become: true become: "{{ do_become }}"
ansible.builtin.dpkg_selections: ansible.builtin.dpkg_selections:
name: "{{ item }}" name: "{{ item }}"
selection: "hold" selection: "hold"

View File

@ -8,7 +8,7 @@
include_tasks: install.yml include_tasks: install.yml
- name: Give user passwordless access to ZFS commands - name: Give user passwordless access to ZFS commands
become: true become: "{{ do_become }}"
lineinfile: lineinfile:
path: /etc/sudoers path: /etc/sudoers
line: "{{ item }} ALL=(ALL) NOPASSWD: /usr/sbin/zfs,/usr/sbin/zpool" line: "{{ item }} ALL=(ALL) NOPASSWD: /usr/sbin/zfs,/usr/sbin/zpool"

View File

@ -99,7 +99,7 @@
- github3.py - github3.py
- hosts: docker - hosts: docker
become: true become: "{{ do_become }}"
tags: tags:
- docker - docker
vars_files: vars_files:
@ -147,7 +147,7 @@
- "vars/vault.yml" - "vars/vault.yml"
tasks: tasks:
- name: Install runtime dependencies - name: Install runtime dependencies
become: true become: "{{ do_become }}"
ansible.builtin.apt: ansible.builtin.apt:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
@ -159,12 +159,12 @@
include_role: include_role:
name: geerlingguy.containerd name: geerlingguy.containerd
apply: apply:
become: true become: "{{ do_become }}"
- name: Include Docker role - name: Include Docker role
include_role: include_role:
name: geerlingguy.docker name: geerlingguy.docker
apply: apply:
become: true become: "{{ do_become }}"
- name: Include Kubernetes role - name: Include Kubernetes role
include_role: include_role:
name: kubernetes name: kubernetes
@ -177,7 +177,7 @@
include_role: include_role:
name: geerlingguy.nfs name: geerlingguy.nfs
apply: apply:
become: true become: "{{ do_become }}"
- hosts: prox - hosts: prox
vars_files: vars_files:
@ -203,12 +203,12 @@
- update - update
tasks: tasks:
- name: Install packages - name: Install packages
become: true become: "{{ do_become }}"
ansible.builtin.apt: ansible.builtin.apt:
name: libraspberrypi-bin name: libraspberrypi-bin
- name: Place PoE fan file - name: Place PoE fan file
become: true become: "{{ do_become }}"
ansible.builtin.copy: ansible.builtin.copy:
content: | content: |
# Ansible managed # Ansible managed
@ -284,7 +284,7 @@
when: ansible_distribution == 'Ubuntu' when: ansible_distribution == 'Ubuntu'
- name: Place MoTD - name: Place MoTD
become: true become: "{{ do_become }}"
when: ansible_distribution == 'Ubuntu' when: ansible_distribution == 'Ubuntu'
ansible.builtin.copy: ansible.builtin.copy:
content: | content: |
@ -303,7 +303,7 @@
- name: Update PiHole - name: Update PiHole
when: inventory_hostname in groups['piholes'] and pihole_exec.stat.exists when: inventory_hostname in groups['piholes'] and pihole_exec.stat.exists
become: true become: "{{ do_become }}"
ansible.builtin.command: ansible.builtin.command:
argv: argv:
- pihole - pihole

View File

@ -1,10 +1,10 @@
- name: Install pip package - name: Install pip package
become: true become: "{{ do_become }}"
ansible.builtin.apt: ansible.builtin.apt:
name: python3-pip name: python3-pip
- name: Install github package - name: Install github package
become: true become: "{{ do_become }}"
ansible.builtin.pip: ansible.builtin.pip:
name: github3.py name: github3.py