<p>If you really want to create the role yourself, you have to use <code>--agree-tos --noninteractive</code> to disable user interaction.</p>

<p>See <a href="https://certbot.eff.org/docs/using.html" rel="nofollow noreferrer">https://certbot.eff.org/docs/using.html</a> for more details</p>

CC BY-SA 3.0
2018-03-25T12:38:34.097Z
2018-03-25T12:38:34.097Z
030
<p>I currently have a doubt for my last line of code to make it work in Ansible, the code is the following:</p>

<pre><code>sudo apt-get update

sudo apt-get upgrade

sudo apt-get install apache2 python-letsencrypt-apache

sudo letsencrypt --apache

sudo apt-get install python-software-properties

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:certbot/certbot

sudo apt-get install python-certbot-apache

sudo certbot --webroot-path /var/www/html -d www.web.tk
</code></pre>

<p>Now I would like to convert it to Ansible:</p>

<pre><code>- apt_repository:
    repo: 'ppa:certbot/certbot'

- apt:
    name: "{{ item }}"
    update_cache: yes
  with_items:
    - all items above
</code></pre>

<p>But I have a problem as the line <code>sudo letsencrypt --apache</code> requires user interaction and I would like to give it the website and email from Ansible inventory file</p>

CC BY-SA 3.0
2018-03-25T08:03:12.780Z
Please add the error logs
030
CC BY-SA 3.0
2018-03-25T09:11:15.067Z
There is no error log, when I do it manually I have no error whatsoever just the translation to Ansible code to execute the raw code with the email and address automatically.
Brask
CC BY-SA 3.0
2018-03-25T12:37:16.640Z
I suggest to not reinvent the wheel and use an ansible role from galaxy like https://galaxy.ansible.com/030/certbot/
030
<ansible><certbot><apache-httpd>
Ansible translation: Installing Apache + Certbot in Ubuntu
Brask
# Ansible translation: Installing Apache + Certbot in Ubuntu

(Asked by: username_0 on 2018-03-24)

I currently have a doubt for my last line of code to make it work in Ansible, the code is the following:
sudo apt-get update

sudo apt-get upgrade

sudo apt-get install apache2 python-letsencrypt-apache

sudo letsencrypt --apache

sudo apt-get install python-software-properties

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:certbot/certbot

sudo apt-get install python-certbot-apache

sudo certbot --webroot-path /var/www/html -d www.web.tk

Now I would like to convert it to Ansible:
- apt_repository:
    repo: 'ppa:certbot/certbot'

- apt:
    name: "{{ item }}"
    update_cache: yes
  with_items:
    - all items above

But I have a problem as the line sudo letsencrypt --apache requires user interaction and I would like to give it the website and email from Ansible inventory file

**Tags:** ansible, certbot, apache-httpd

> **Comments:**
> **username_1**: Please add the error logs  
> **username_0**: There is no error log, when I do it manually I have no error whatsoever just the translation to Ansible code to execute the raw code with the email and address automatically.  
> **username_1**: I suggest to not reinvent the wheel and use an ansible role from galaxy like https://galaxy.ansible.com/username_1/certbot/  

---

## 1 answers

### Answer by username_1 on 2018-03-25. Score: 1

If you really want to create the role yourself, you have to use `--agree-tos --noninteractive` to disable user interaction.

See <https://certbot.eff.org/docs/using.html> for more details


---

