mirror of
https://github.com/lemeow125/ansible-playbooks.git
synced 2024-11-17 04:09: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:
|
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`
|
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`
|
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:
|
To run an Ansible playbook, navigate to the desired playbook directory and execute:
|
||||||
|
|
||||||
```bash
|
```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
|
# Runs on root user already
|
||||||
become: false
|
become: false
|
||||||
tasks:
|
tasks:
|
||||||
- name: Add SSH key to authorized_hosts
|
- name: Add SSH key to authorized_hosts - Debian/Ubuntu
|
||||||
authorized_key:
|
authorized_key:
|
||||||
user: root
|
user: root
|
||||||
state: present
|
state: present
|
||||||
key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
|
key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
|
||||||
path: /root/.ssh/authorized_keys
|
path: /root/.ssh/authorized_keys
|
||||||
|
when: ansible_distribution in ["Debian", "Ubuntu"]
|
||||||
- name: Update all packages
|
- name: Update all packages
|
||||||
apt:
|
apt:
|
||||||
update_cache: true
|
update_cache: true
|
||||||
autoremove: true
|
autoremove: true
|
||||||
state: latest
|
state: latest
|
||||||
- name: Install packages
|
- name: Install packages - Debian/Ubuntu
|
||||||
apt:
|
apt:
|
||||||
name:
|
name:
|
||||||
- vim
|
- vim
|
||||||
|
@ -27,8 +28,10 @@
|
||||||
- neofetch
|
- neofetch
|
||||||
- cifs-utils
|
- cifs-utils
|
||||||
- curl
|
- curl
|
||||||
|
# Cache is already updated from previous step
|
||||||
update_cache: false
|
update_cache: false
|
||||||
autoremove: true
|
autoremove: true
|
||||||
state: latest
|
state: latest
|
||||||
|
when: ansible_distribution in ["Debian", "Ubuntu"]
|
||||||
- name: Install ACME
|
- name: Install ACME
|
||||||
command: curl https://get.acme.sh | sh -s email=noehbernasol0@gmail.com
|
command: curl https://get.acme.sh | sh -s email=noehbernasol0@gmail.com
|
||||||
|
|
|
@ -8,5 +8,7 @@
|
||||||
update_cache: true
|
update_cache: true
|
||||||
autoremove: true
|
autoremove: true
|
||||||
state: latest
|
state: latest
|
||||||
|
when: ansible_distribution in ["Debian", "Ubuntu"]
|
||||||
- name: Update ACME
|
- name: Update ACME
|
||||||
command: /root/.acme.sh/acme.sh --upgrade --auto-upgrade
|
command: /root/.acme.sh/acme.sh --upgrade --auto-upgrade
|
||||||
|
when: ansible_distribution in ["Debian", "Ubuntu"]
|
||||||
|
|
Loading…
Reference in a new issue