From 9ff48de7fc3a73a908398a6f8320c66d48fab27e Mon Sep 17 00:00:00 2001 From: Shankar Mounesh Date: Sun, 12 Jun 2022 18:25:55 +0530 Subject: [PATCH] added ansible user --- README.md | 5 +---- files/sources.list | 1 + files/sudoer_ansible | 1 + proxmox.yml | 24 ++++++++++++++++-------- 4 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 files/sudoer_ansible diff --git a/README.md b/README.md index c822074..a3abfac 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,7 @@ The above command downloads a bash file from 172.16.16.65 and runs the following ```sh apt update -y; -apt install git -y; -apt install software-properties-common -y; -add-apt-repository --yes --update ppa:ansible/ansible; -apt install ansible -y; +apt install git ansible -y; ansible --version; ansible-pull -U https://git.bitsathy.ac.in/ShankarMounesh/ansible-proxmox.git ``` diff --git a/files/sources.list b/files/sources.list index fd34256..ea2d363 100644 --- a/files/sources.list +++ b/files/sources.list @@ -7,4 +7,5 @@ deb http://security.debian.org/debian-security bullseye-security main contrib # PVE pve-no-subscription repository provided by proxmox.com, # NOT recommended for production use + deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription \ No newline at end of file diff --git a/files/sudoer_ansible b/files/sudoer_ansible new file mode 100644 index 0000000..9888393 --- /dev/null +++ b/files/sudoer_ansible @@ -0,0 +1 @@ +ansible ALL=(ALL) NOPASSWD: ALL diff --git a/proxmox.yml b/proxmox.yml index 3c65b30..9857bfe 100644 --- a/proxmox.yml +++ b/proxmox.yml @@ -19,11 +19,6 @@ dest: /etc/apt/sources.list.d/pve-enterprise.list owner: root group: root - - # - name: Remove ansible repo - # community.general.apt_repo: - # repo: ansible/ansible - # state: absent tasks: @@ -33,6 +28,19 @@ - name: dist upgrade apt: upgrade=dist - - name: Unconditionally reboot the machine with all defaults - reboot: - reboot_command: reboot + - name: adding a user for ansible cron job + user: + name: ansible + system: yes + + - name: setup sudo for ansible user + copy: + src: files/sudoer_ansible + dest: /etc/sudoers.d/ansible + owner: root + group: root + mode: 0440 + + - name: reboot the machine + ansible.builtin.shell: reboot +