mirror of
https://github.com/lemeow125/ansible-playbooks.git
synced 2024-11-16 19:59:26 +08:00
Add distribution filter and update README
This commit is contained in:
parent
d097b005e1
commit
3fe0152550
4 changed files with 18 additions and 5 deletions
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
|
@ -1,3 +1,9 @@
|
|||
{
|
||||
"ansible.python.interpreterPath": "c:\\Users\\keannu125\\AppData\\Local\\Programs\\Python\\Python311\\python.exe"
|
||||
"ansible.python.interpreterPath": "c:\\Users\\keannu125\\AppData\\Local\\Programs\\Python\\Python311\\python.exe",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ This repository contains my Ansible playbook configuration and scripts.
|
|||
|
||||
To install the Ansible playbook, follow these steps:
|
||||
|
||||
1. Clone this repository using `git clone <repository-url>`
|
||||
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`
|
||||
|
||||
|
@ -15,5 +15,7 @@ To install the Ansible playbook, follow these steps:
|
|||
To run an Ansible playbook, navigate to the desired playbook directory and execute:
|
||||
|
||||
```bash
|
||||
ansible-playbook -i inventory.ini playbook.yml
|
||||
ansible-playbook -i inventory playbook.yml
|
||||
```
|
||||
|
||||
Don't forget to update hosts in `inventory`!
|
||||
|
|
|
@ -3,18 +3,19 @@
|
|||
# Runs on root user already
|
||||
become: false
|
||||
tasks:
|
||||
- name: Add SSH key to authorized_hosts
|
||||
- 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
|
||||
- name: Install packages - Debian/Ubuntu
|
||||
apt:
|
||||
name:
|
||||
- vim
|
||||
|
@ -27,8 +28,10 @@
|
|||
- neofetch
|
||||
- cifs-utils
|
||||
- curl
|
||||
# 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
|
||||
|
|
|
@ -8,5 +8,7 @@
|
|||
update_cache: true
|
||||
autoremove: true
|
||||
state: latest
|
||||
when: ansible_distribution in ["Debian", "Ubuntu"]
|
||||
- name: Update ACME
|
||||
command: /root/.acme.sh/acme.sh --upgrade --auto-upgrade
|
||||
when: ansible_distribution in ["Debian", "Ubuntu"]
|
||||
|
|
Loading…
Reference in a new issue