snippetMinor
How to install Certbot via Ansible playbook?
Viewed 0 times
installcertbotplaybookviahowansible
Problem
This is how I install Certbot in a Bash script:
That's the playbook syntax I found to install Nginx in default conf:
Is there no Ansible task to install Certbot as well, instead the above "heavier" Bash code?
apt-get update -y && add-apt-repository ppa:certbot/certbot -y && apt-get update -y
apt-get upgrade nginx python-certbot-nginx -yThat's the playbook syntax I found to install Nginx in default conf:
- hosts: localhost
connection: local
become: true
tasks:
- name: install nginx
apt: pkg=nginx state=installed update_cache=trueIs there no Ansible task to install Certbot as well, instead the above "heavier" Bash code?
Solution
Here is the direct Ansible translation of your bash install script:
- apt_repository:
repo: 'ppa:certbot/certbot'
- apt:
name: "{{ item }}"
update_cache: yes
with_items:
- nginx
- python-certbox-nginxCode Snippets
- apt_repository:
repo: 'ppa:certbot/certbot'
- apt:
name: "{{ item }}"
update_cache: yes
with_items:
- nginx
- python-certbox-nginxContext
StackExchange DevOps Q#3155, answer score: 5
Revisions (0)
No revisions yet.