diff --git a/.vscode/settings.json b/.vscode/settings.json index 11c64eb..9b2da51 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,10 +3,7 @@ "yaml.schemas": { "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible.json#/$defs/playbook": [ "file:///e%3A/Projects/AnsibleTest/setup.yml", - "file:///e%3A/Projects/AnsibleTest/update.yml", - "file:///e%3A/Projects/ansible-playbooks/roles/tasks/update.yml", - "file:///e%3A/Projects/ansible-playbooks/roles/tasks/setup.yml" - ], - "https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/requirements.json": "file:///e%3A/Projects/ansible-playbooks/requirements.yml" + "file:///e%3A/Projects/AnsibleTest/update.yml" + ] } } diff --git a/README.md b/README.md index a98504f..5d13213 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,6 @@ To install the Ansible playbook, follow these steps: 1. Clone this repository 2. Install Ansible on your system if you haven't already: `sudo apt-get install ansible` 3. Move into the repository directory: `cd /path/to/ansible-playbooks` -4. Navigate to the repository directory: `cd /path/to/ansible-playbooks` -5. Install required Ansible Galaxy roles using Ansible Galaxy: `ansible-galaxy install -r requirements.yml` ## Usage diff --git a/ansible.cfg b/ansible.cfg index 8495b92..1f82b59 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,3 +1,3 @@ [defaults] -inventory = inventory/hosts +inventory = inventory private_key_file = ~/.ssh/id_rsa \ No newline at end of file diff --git a/inventory b/inventory new file mode 100644 index 0000000..2fb0614 --- /dev/null +++ b/inventory @@ -0,0 +1,3 @@ +10.0.10.4 +10.0.10.64 +10.0.10.141 \ No newline at end of file diff --git a/inventory/group_vars/debian.yml b/inventory/group_vars/debian.yml deleted file mode 100644 index a7d4a89..0000000 --- a/inventory/group_vars/debian.yml +++ /dev/null @@ -1 +0,0 @@ -# Debian-specific variables go here diff --git a/inventory/group_vars/openwrt.yml b/inventory/group_vars/openwrt.yml deleted file mode 100644 index 3e28929..0000000 --- a/inventory/group_vars/openwrt.yml +++ /dev/null @@ -1 +0,0 @@ -# OpenWRT-specific variables go here diff --git a/inventory/host_vars/10.0.10.1.yml b/inventory/host_vars/10.0.10.1.yml deleted file mode 100644 index b34f540..0000000 --- a/inventory/host_vars/10.0.10.1.yml +++ /dev/null @@ -1 +0,0 @@ -# ARMv7 OpenWRT-specific variables for LeRouter-1 go here diff --git a/inventory/hosts b/inventory/hosts deleted file mode 100644 index f7e3d16..0000000 --- a/inventory/hosts +++ /dev/null @@ -1,9 +0,0 @@ -[debian] -10.0.10.4 -10.0.10.64 -10.0.10.141 - -[openwrt] -10.0.10.1 -10.0.10.2 -10.0.10.3 \ No newline at end of file diff --git a/requirements.yml b/requirements.yml deleted file mode 100644 index bf317d8..0000000 --- a/requirements.yml +++ /dev/null @@ -1,3 +0,0 @@ -- src: https://github.com/gekmihesg/ansible-openwrt.git - scm: git - version: master diff --git a/roles/tasks/debian/setup.yml b/setup.yml similarity index 77% rename from roles/tasks/debian/setup.yml rename to setup.yml index 0f29358..d8b3718 100644 --- a/roles/tasks/debian/setup.yml +++ b/setup.yml @@ -1,21 +1,21 @@ --- -- hosts: - - debian +- hosts: all # Runs on root user already become: false tasks: - - name: Add SSH key to authorized_hosts - Debian + - name: Add SSH key to authorized_hosts - Debian/Ubuntu authorized_key: user: root state: present key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" path: /root/.ssh/authorized_keys + when: ansible_distribution in ["Debian", "Ubuntu"] - name: Update all packages apt: update_cache: true autoremove: true state: latest - - name: Install packages - Debian + - name: Install packages - Debian/Ubuntu apt: name: - vim @@ -29,12 +29,10 @@ - cifs-utils - borgbackup - curl - - syncthing - - socat - - fish # Cache is already updated from previous step update_cache: false autoremove: true state: latest + when: ansible_distribution in ["Debian", "Ubuntu"] - name: Install ACME command: curl https://get.acme.sh | sh -s email=noehbernasol0@gmail.com diff --git a/roles/tasks/debian/update.yml b/update.yml similarity index 67% rename from roles/tasks/debian/update.yml rename to update.yml index 4223aad..707ed69 100644 --- a/roles/tasks/debian/update.yml +++ b/update.yml @@ -1,6 +1,5 @@ --- -- hosts: - - debian +- hosts: all # Runs on root user already become: false tasks: @@ -9,6 +8,7 @@ update_cache: true autoremove: true state: latest - when: ansible_distribution in ["Debian"] + when: ansible_distribution in ["Debian", "Ubuntu"] - name: Update ACME command: /root/.acme.sh/acme.sh --upgrade --auto-upgrade + when: ansible_distribution in ["Debian", "Ubuntu"]