xlab-steampunk / steampunk.unit

Ansible Collection for managing NGINX Unit
GNU General Public License v3.0
3 stars 2 forks source link

Undocumented reference in <collection>/roles/install/tasks/repositories.yml #2

Open ghost opened 3 years ago

ghost commented 3 years ago

Hi everyone, the tech writer for NGINX Unit here. Couldn't find the docs repo, so I'm dropping a note here instead.

First, thanks for promoting our project, much appreciated!

Second, I'm considering adding a brief section on your NGINX Unit Ansible collection to the official docs (somewhere here: https://unit.nginx.org/installation/#community-repositories), but I've ran into the following issue during a replay:

TASK [install : Prepare package repositories] *******************************************************************************************************************
included: /home/vagrant/.ansible/collections/ansible_collections/steampunk/unit/roles/install/tasks/repositories.yml for 127.0.0.1

TASK [install : Prepare package repositories] *******************************************************************************************************************
fatal: [127.0.0.1]: FAILED! => {"reason": "Could not find or access '/home/vagrant/ansible/Ubuntu/repositories.yml' on the Ansible Controller."}

Obviously, the collection's <collection>/roles/install/tasks/repositories.yml refers to the missing file. The quickstart was unfortunately missing any mentions of repositories.yml, so I jury-rigged the following:

vagrant@ubuntu-focal:~/ansible$ cat Ubuntu/repositories.yml
---
- name: Add nginx signing key (Debian/Ubuntu)
  apt_key:
    url: http://nginx.org/keys/nginx_signing.key
    state: present
  when: ansible_os_family == "Debian"

- name: Add Unit repository (Ubuntu 20.04)
  apt_repository: repo={{item}} state=present update_cache=yes
  with_items:
    - 'deb https://packages.nginx.org/unit/ubuntu/ focal unit'
    - 'deb-src https://packages.nginx.org/unit/ubuntu/ focal unit'
  when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "20")

After this, everything went smoothly.

My question is, where does this file (repositories.yml) come from in your reference setup? Am I right in assuming it's omitted in the quickstart by accident only? Maybe I should provide the instructions on its creation in our docs to smoothen the process for the reader?

Admittedly, I'm new to Ansible, so I may be chasing windmills here.

P.S. There's a small typo as well: https://docs.steampunk.si/unit/quickstart.html name:steampunk.unit.install - missing space.

tadeboro commented 3 years ago

Hi @artemkonev!

The docs repo is this repo. All of the documentation is rendered from the sources in the docs/sources folder. The only problem is that I forgot to push that part to GitHub. I will do this right now before I forget once again.

As for the Ubuntu stuff, the current version of the collection does not have Ubuntu support (sell https://docs.steampunk.si/unit/roles/install.html#tested-platforms-ci-cd). Platform-specific task files live in appropriately-named directories in https://github.com/xlab-steampunk/steampunk.unit/tree/master/roles/install/tasks. As you can see, we have CentOS and Debian there. Adding support for Ubuntu should be as easy as copying over the Debian stuff and adjusting the repositories a bit to fit the Ubuntu naming scheme.

The error message from Ansible is a bit deceiving because it only reported one location where task files can live. And in this case, it got the location wrong. The final location of the missing file should in your case be /home/vagrant/.ansible/collections/ansible_collections/steampunk/unit/roles/install/tasks/Ubuntu.repositories.yml.

Did I manage to at least partially explain things? Feel free to ping me for more details.

tadeboro commented 3 years ago

As promised, I added documentation to the repository in https://github.com/xlab-steampunk/steampunk.unit/pull/3 We also updated the documentation site (and we fixed the typo you found).

ghost commented 3 years ago

Great, @tadeboro , thanks a lot! Everything's quite clear now. One final question - may I use the playbook sample in our docs?

tadeboro commented 3 years ago

One final question - may I use the playbook sample in our docs?

Sure. A link to our docs would be appreciated.