Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible/bbb role #37

Merged
merged 49 commits into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2e56850
Add BigBlueButton role, update known_hosts, hosts, README
anadahz May 3, 2020
329044d
Use upstream git repository, add nginx options
anadahz May 12, 2020
622a8bb
Update role versions, add/update config vars
anadahz Sep 25, 2020
4a9248d
Remove default vars, add npm user, set log to ERROR
anadahz Sep 25, 2020
991ec98
Add documentation about Ansible encrypted strings
anadahz Sep 25, 2020
bb4c026
Bump min Ansible version, simplify version comparison
anadahz Sep 26, 2020
c02d7f1
Add molecule testing of BigBlueButton Ansible role
anadahz Sep 26, 2020
b31c8ef
Reduce Vagrant RAM to 4G and 2 CPU core due to Travis limits
anadahz Sep 26, 2020
eb64e5f
update ansible pipfile version
Sep 26, 2020
5f14ad8
lower ansible version requirement to 2.10.0
francisco-core Sep 26, 2020
fb75a59
lower ansible version requirement to 2.10.0
francisco-core Sep 26, 2020
25c0ad4
break line to pass yaml lint
francisco-core Sep 26, 2020
e640d90
remove admin role from deployment
francisco-core Sep 26, 2020
9b465af
Fix Molecule, Add CI dir, bump versions, split rake cmd
anadahz Oct 2, 2020
e9a0ad1
Merge branch 'ansible/bbb-role'
anadahz Oct 2, 2020
3a53005
No need for an OpenSSH keypair
anadahz Oct 2, 2020
f2686f9
Add admin role dependency, workaround is not required?
anadahz Oct 3, 2020
f4e71c7
Fix admin role molecule testing on another branch
anadahz Oct 9, 2020
48f7181
Run local_action as non privileged user
anadahz Oct 22, 2020
7458ed6
Import Ansible galaxy role
anadahz Nov 1, 2020
28eae25
Do not define vars directory
anadahz Nov 2, 2020
995006b
Expose role's vars and defaults to the playbook
anadahz Nov 2, 2020
5a4b271
Do not define vars playbook_dir
anadahz Nov 2, 2020
6136c68
Fix Travis
anadahz Nov 2, 2020
d5950b3
Remove unsupported Ubuntu version
anadahz Nov 2, 2020
654ec16
Update brach with current master
anadahz Nov 2, 2020
4c4a8bd
Use exact rake command from upstream
anadahz Nov 2, 2020
a522472
Testing generate password with only ASCII letters and digits
anadahz Nov 2, 2020
19caf88
Fix rake command indentation
anadahz Nov 2, 2020
79b4f43
Reduce generated test password to fix rake command in Travis
anadahz Nov 2, 2020
e0e9a18
Send rake command as a list
anadahz Nov 2, 2020
2720b84
Fix rake command
anadahz Nov 2, 2020
eb5b6a9
Do not break rake command
anadahz Nov 17, 2020
ca98303
Do not fail idempotency on task
anadahz Nov 17, 2020
1cef3eb
Ignore task during idempotency test
anadahz Nov 17, 2020
02edc02
Disable line-length check for specific line
anadahz Nov 17, 2020
bdfb5cc
Fix yamllint comment position
anadahz Nov 17, 2020
181eb75
Do not force install dependencies, change timeout to 20s
anadahz Nov 17, 2020
aad9d55
Do not check idempotency of changing tasks
anadahz Nov 18, 2020
0838325
Ignore idempotency testing on BBB role, add force option
anadahz Nov 18, 2020
438f018
Attemp to fix idempotency of ansible-galaxy with creates option
anadahz Nov 18, 2020
f5bbd74
Fix lint, allow multiple spaces inside braces
anadahz Nov 18, 2020
7ef7b4c
Fix rake command
anadahz Nov 18, 2020
0dc74ef
Fix user creation command
anadahz Nov 18, 2020
1635331
Fix yamllint, do not check idempotence for specific task
anadahz Dec 23, 2020
93fa142
Install CI dependencies, upgrade Vagrant, ignore idempotence
anadahz Dec 30, 2020
33cea74
Merge branch 'master' into ansible/bbb-role
anadahz Dec 30, 2020
71e085f
Set min ansible version, bump upstream role version
anadahz Jan 2, 2021
f462860
Update apt cache
anadahz Jan 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.swp
*.swo
ansible/roles.galaxy
43 changes: 10 additions & 33 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---

os: linux
dist: bionic
language: python
python:
- "3.7"
python: "3.8"

jobs:
include:
- name: "Testing ansible playbook `deploy-discourse.yml`"
env: TEST_ROLE=discourse
- name: "Testing ansible playbook `deploy-bigbluebutton.yml`"
env: TEST_ROLE=bigbluebutton
- name: "Testing ansible playbook `deploy-matterbridge.yml`"
env: TEST_ROLE=matterbridge

Expand All @@ -18,35 +18,12 @@ cache:
- /home/travis/.vagrant.d/boxes
- /home/travis/.cache/pipenv

before_install:
# Install libvirt, travis and KVM
# https://github.com/alvistack/ansible-role-virtualbox/blob/master/.travis.yml
- |
curl -Os https://releases.hashicorp.com/vagrant/2.2.7/vagrant_2.2.7_x86_64.deb
curl -Os https://releases.hashicorp.com/vagrant/2.2.7/vagrant_2.2.7_SHA256SUMS
curl -Os https://releases.hashicorp.com/vagrant/2.2.7/vagrant_2.2.7_SHA256SUMS.sig
gpg --receive-key 51852D87348FFC4C
gpg --verify vagrant_2.2.7_SHA256SUMS.sig vagrant_2.2.7_SHA256SUMS
sha256sum -c vagrant_2.2.7_SHA256SUMS 2>&1 | grep OK
sudo apt-get -qq update
sudo apt-get -qq install bridge-utils dnsmasq-base ebtables libvirt-bin \
libvirt-dev qemu-kvm qemu-utils ruby-dev
sudo dpkg -i vagrant_2.2.7_x86_64.deb
sudo vagrant plugin install vagrant-libvirt
sudo vagrant plugin list
rm -rf vagrant_2.2.7_*
# pipenv installation
# https://github.com/jonashackt/molecule-ansible-docker-aws/blob/master/.travis.yml
- |
sudo apt-get -qq install python3.7
curl -skL https://bootstrap.pypa.io/get-pip.py | sudo -H python3.7
sudo -H pip3 install pipenv
sudo -H pipenv install
install:
- cd ci && ./install.sh

script:
- |
cd ansible/roles/$TEST_ROLE
sudo -E pipenv run molecule lint
sudo -E pipenv run molecule syntax
travis_wait 30 sudo -E pipenv run molecule converge
travis_wait 30 sudo -E pipenv run molecule idempotence
- cd ${TRAVIS_BUILD_DIR}/ansible/roles/$TEST_ROLE
- sudo -E pipenv run molecule lint
- sudo -E pipenv run molecule syntax
- travis_wait 30 sudo -E pipenv run molecule converge
- travis_wait 30 sudo -E pipenv run molecule idempotence
5 changes: 3 additions & 2 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ extends: default

rules:
braces:
max-spaces-inside: 1
max-spaces-inside: -1
min-spaces-inside: 2
level: error
brackets:
max-spaces-inside: 1
Expand All @@ -29,5 +30,5 @@ rules:
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
trailing-spaces: enable
truthy: disable
14 changes: 0 additions & 14 deletions Pipfile

This file was deleted.

22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ after package upgrades:

`cd ansible && ansible-playbook --vault-id @prompt -i inventory/production deploy-update.yml --extra-vars=reboot_enabled=true`

### Deploy BigBlueButton

`cd ansible && ansible-playbook --vault-id @prompt -i inventory/production deploy-bigbluebutton.yml`

## Adding SSH fingerprints to known hosts

1. Get an SSH fingerprint from a local `known_hosts` file for a given hostname
Expand All @@ -124,11 +128,29 @@ List almost all group/host variables:

`ansible --vault-id @prompt -i inventory/testing -m debug group/host -a "var=vars"`

### Ansible vault

#### Create encrypted strings

Use `encrypt_string` to create encrypted variables to embed in inventory file:

`ansible-vault encrypt_string --vault-id prompt --stdin-name 'variable_name'`

**Note:** Do not press Enter after supplying the string. That will add a newline
to the encrypted value.

#### View encrypted strings

You can view the original value of an encrypted string by using the debug module:

`ansible localhost -m debug -a var="variable_name" -e "@ansible/inventory/testing/group_vars/all/vars.yml" --vault-id prompt`

### Docs

- [Ansible Documentation: Playbook Filters](https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html)
- [Ansible Documentation: Using Variables]( https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html)
- [Ansible Documentation: Special Variables](https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html)
- [Ansible Documentation: Vault](https://docs.ansible.com/ansible/latest/user_guide/vault.html)

## Naming convention

Expand Down
22 changes: 8 additions & 14 deletions ansible/ansible-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,14 @@
connection: local
gather_facts: false
tags: always
tasks:
pre_tasks:
- name: Set minimun required Ansible version
set_fact:
ansible_version_min: 2.10.0
- name: Ensure we have minimum Ansible version "{{ ansible_version_min }}"
assert:
msg: "ansible_version: {{ ansible_version }}"
that: "ansible_version.full is version_compare('{{ ansible_version_min }}', '>=')"
when: "ansible_version.full is version_compare('2.7', '<')"
run_once: true

- name: Ensure we have minimum Ansible version "{{ ansible_version_min }}"
assert:
that: "ansible_version.full is version_compare('{{ ansible_version_min }}', '>=')"
fail_msg: >-
"ansible_version: {{ ansible_version.full }}"
"You must install Ansible version >= {{ ansible_version_min }}"
success_msg: "ansible_version: {{ ansible_version.full }}"
when: "ansible_version.full is version_compare('2.7', '>=')"
that: ansible_version.full is version('{{ ansible_version_min }}', '>=')
msg: |
You are using Ansible version: {{ ansible_version.full }}
The minimum required version of Ansible is: {{ ansible_version_min }}
anadahz marked this conversation as resolved.
Show resolved Hide resolved
run_once: true
11 changes: 11 additions & 0 deletions ansible/deploy-bigbluebutton.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

- import_playbook: ansible-version.yml

- name: "Deploy a BigBlueButton server"
hosts: "{{ target if target is defined else 'bigbluebutton' }}"
become: true

roles:
- role: bigbluebutton
tags: molecule-idempotence-notest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this tag do? I would assume it disables the idempotence molecule test as you referred to as having issues, but I don't see this tag being referenced anywhere. How does it work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is actually instruct molecule to not check for idempotency on this specific role.
We could add an issue to look into it and make idempotency work for this role.

Copy link
Contributor

@francisco-core francisco-core Jan 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine. It's just that I didn't see any code referencing this tag. Can you point me to the line where molecule does this? Or is it in the other commit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://molecule.readthedocs.io/en/latest/configuration.html#id7

Molecule will skip tasks which are tagged with either molecule-notest or notest. With the tag molecule-idempotence-notest tasks are only skipped during the idempotence action step.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

3 changes: 0 additions & 3 deletions ansible/inventory/molecule/group_vars/all/vars.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Minimun required Ansible version
ansible_version_min: 2.8

# Admin email address
admin_email: [email protected]

Expand Down
67 changes: 67 additions & 0 deletions ansible/inventory/molecule/group_vars/bigbluebutton/vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
bbb_letsencrypt_enable: false
bbb_letsencrypt_email: [email protected]
# Use latest to update BBB and present to keep currently installed version.
bbb_state: "latest"
bbb_api_demos_enable: false
bbb_disable_recordings: true
# Greenlight registration mode: open (default), invite, approval
bbb_greenlight_default_registration: approval
# https://docs.bigbluebutton.org/2.2/troubleshooting.html#freeswitch-fails-to-start-with-a-setscheduler-error
bbb_cpuschedule: false
# https://docs.bigbluebutton.org/2.2/troubleshooting.html#freeswitch-fails-to-bind-to-port-8021
bbb_freeswitch_ipv6: false
# Generate Diff-Hellmann for nginx
bbb_nginx_dh: yes
bbb_app_log_level: 'ERROR'

# https://github.com/bigbluebutton/bigbluebutton/blob/develop/bigbluebutton-html5/private/config/settings.yml
bbb_meteor:
public:
app:
clientTitle: "Molecule - BigBlueButton"
helpLink: "https://privacylx.org/community/"
mirrorOwnWebcam: true
kurento:
cameraProfiles:
- id: low
name: Low quality
default: true
bitrate: 50
- id: medium
name: Medium quality
default: false
bitrate: 100
- id: high
name: High quality
default: false
bitrate: 200
- id: hd
name: High definition
default: false
bitrate: 400
hidden: true
cameraQualityThresholds:
enabled: true
thresholds:
- threshold: 8
profile: low-u8
- threshold: 12
profile: low-u12
- threshold: 15
profile: low-u15
- threshold: 20
profile: low-u20
- threshold: 25
profile: low-u25
- threshold: 30
profile: low-u30

bbb_coturn_secret: "{{ lookup('password', '/tmp/passwordfile length=80') }}"
bbb_turn_secret: "{{ lookup('password', '/tmp/passwordfile length=80') }}"
bbb_greenlight_secret: "{{ lookup('password', '/tmp/passwordfile length=80') }}"
bbb_greenlight_db_password: "{{ lookup('password', '/tmp/passwordfile length=80') }}"
# BigBlueButton admin user
bbb_adm:
name: Admin Test User
email: [email protected]
pass: "{{ lookup('password', '/tmp/passwordfile length=30 chars=ascii_letters') }}"
3 changes: 0 additions & 3 deletions ansible/inventory/production/group_vars/all/vars.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Minimun required Ansible version
ansible_version_min: 2.8

# PrivacyLx website
website_host: privacylx.org

Expand Down
Loading