How run the Volttron playbook install-platform.yml with Ansible - ansible

First I install the Volttron recipes via
ansible-galaxy install git+https://github.com/volttron/volttron-ansible.git
Then Verify the install
ansible-galaxy list
# /Users/username/.ansible/roles
- volttron-ansible, (unknown version)
Then I setup the host and try to run the playbook
ansible-playbook -K \
-i $TEST_HOST \
playbooks/install-platform.yml
# TEST_HOST is the path the to host file
And I get the error:
ERROR! the role 'volttron.deployment.set_defaults' was not found in /Users/username/Development/iot/experiment-volttron/playbooks/roles:/Users/username/.ansible/roles/volttron-ansible:/Users/username/Development/iot/experiment-volttron/playbooks
The error appears to be in '/Users/username/Development/iot/experiment-volttron/playbooks/install-platform.yml': line 6, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
roles:
- volttron.deployment.set_defaults
^ here
The Host connects correctly - and the roles seemed to be installed at /Users/username/.ansible/roles/volttron-ansible correctly.
Any suggestions?

Related

Ansible AWX on K3s - Galaxy install problem "Failed to download collection tar from 'server0': <urlopen error [Errno -2] Name or service not known"

I have a problem with the Ansible AWX instance on K3s.
Used guide: https://computingforgeeks.com/how-to-install-ansible-awx-on-ubuntu-linux/
I want to use the Ansible collections install option when syncing my project to git but that doesn't work.
I am using collections/requirements.yml file which during execution expects on a random collection (I want to install 7 collections from)
My collections:
community.general
community.mysql
community.docker
ansible.posix
community.vmware
community.zabbix
awx.awx
Error with job details (Standard Error):
ERROR! Failed to download collection tar from 'server0': <urlopen error [Errno -2] Name or service not known>
Error with manual installation in a container with -vvv and -c flags
bash-4.4$ ansible-galaxy collection install -r requirements.yml --collections-path /var/lib/awx/projects/.__awx_cache/_15__gitlab_ansible_awx_devops/stage/requirements_collections -vvv -c
ansible-galaxy [core 2.12.5.post0]
config file = None
configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-galaxy
python version = 3.8.12 (default, Sep 21 2021, 00:10:52) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
jinja version = 2.10.3
libyaml = True
No config file found; using defaults
Reading requirement file at '/var/lib/awx/projects/_15__gitlab_ansible_awx_devops/collections/requirements.yml'
Starting galaxy collection install process
Process install dependency map
Opened /home/runner/.ansible/galaxy_token
[WARNING]: Skipping Galaxy server https://galaxy.ansible.com/api/. Got an unexpected error when getting available versions of collection community.general: Unknown
error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/v2/collections/community/general/': <urlopen error [Errno 101] Network is unreachable>
ERROR! Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/v2/collections/community/general/': <urlopen error [Errno 101] Network is unreachable>
It alternates between getting the error with "Network is unreachable" and "Name or service not known". Local installation goes without any problem.
Thanks for any help
Info:
Ubuntu 20.04
ansible [core 2.12.5.post0]
AWX 21.1.0
k3s version v1.23.6+k3s1 (418c3fa8)

I can't install a role from github by the version tag

The repo and tag look good to me. I can install it without specifying the tag, but then it's not versioned:
Starting galaxy role install process
[WARNING]: - ansible-role-shell was NOT installed successfully: - command /usr/bin/git checkout v0.0.1 failed in directory
/home/spiderman/.ansible/tmp/ansible-local-96104higi5m4h/tmpzuylb5_v/ansible-role-shell (rc=1) - error: pathspec 'v0.0.1' did not match
any file(s) known to git
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
spiderman#parallels-Parallels-Virtual-Platform:~$ ansible-galaxy install git+https://github.com/natemarks/ansible-role-shell.git
Starting galaxy role install process
- extracting ansible-role-shell to /home/spiderman/.ansible/roles/ansible-role-shell
- ansible-role-shell was installed successfully
spiderman#parallels-Parallels-Virtual-Platform:~$ ansible-galaxy list
# /home/spiderman/.ansible/roles
- ansible-role-shell, (unknown version)
[WARNING]: - the configured path /usr/share/ansible/roles does not exist.
[WARNING]: - the configured path /etc/ansible/roles does not exist.
Thanks in advance for any suggestions!
I thought I had pushed tags. Answer in comments correctly pointed out that I did not.

ansible-galaxy install ahuffman.resolv does not work

I thought I had found something that would make managing the /etc/resolv.conf file easy. https://galaxy.ansible.com/ahuffman/resolv but when I try to install this role as per the documentation like so ...
bash-3.2$ ansible-galaxy install ahuffman.resolv
I get this error ...
Starting galaxy role install process
[WARNING]: - ahuffman.resolv was NOT installed successfully: Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': <urlopen error [SSL:
CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)>
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
I have never used ansible-galaxy before ... and probably won't ever again :(
Please help.
If I run with -vvvv I see this additional output:
ansible-galaxy 2.10.5
config file = None
configured module search path = ['/Users/red/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible
executable location = /Library/Frameworks/Python.framework/Versions/3.6/bin/ansible-galaxy
python version = 3.6.8 (v3.6.8:3c6b436a57, Dec 24 2018, 02:04:31) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
No config file found; using defaults
Starting galaxy role install process
Processing role ahuffman.resolv
Initial connection to galaxy_server: https://galaxy.ansible.com
Opened /Users/red/.ansible/galaxy_token
Calling Galaxy at https://galaxy.ansible.com/api/
[WARNING]: - ahuffman.resolv was NOT installed successfully: Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': <urlopen error [SSL:
CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)>
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
Running with --ignore-certs seems to have fixed the problem but the usage from anisble-galaxy does mention a --ignore-certs option:
usage: ansible-galaxy [-h] [--version] [-v] TYPE ...
Perform various Role and Collection related operations.
positional arguments:
TYPE
collection Manage an Ansible Galaxy collection.
role Manage an Ansible Galaxy role.
optional arguments:
--version show program's version number, config file location,
configured module search path, module location, executable
location and exit
-h, --help show this help message and exit
-v, --verbose verbose mode (-vvv for more, -vvvv to enable connection
debugging)

Error running playbook with encrypted group_vars

I am trying to run a playbook with a file that has been encrypted using ansible-vault. However, I get the following error:
ERROR! Syntax Error while loading YAML.
could not find expected ':'
The error appears to have been in 'inventories/group_vars/main_server': line 41, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
Content of vault file:
me#server:ansible$ cat inventories/group_vars/main_server
$ANSIBLE_VAULT;1.1;AES256
...
Command I'm running:
ansible-playbook -i inventories/group_vars/main_server --extra-vars "target=my_target" playbook.yml --ask-become-pass --ask-pass --vault-password-file vault_pwd.txt
vault_pwd.txt is populated with the required password. I have been encrypting/decrypting as I develop my playbook. For instance, the shell script with the encrypting command:
ansible-vault encrypt inventories/group_vars/main_server --vault-password-file vault_pwd.txt
Edit #1
Version of Ansible:
me#server:ansible$ ansible --version
ansible 2.7.5
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/me/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]
The error you're seeing...
ERROR! Syntax Error while loading YAML.
could not find expected ':'
The error appears to have been in 'inventories/group_vars/main_server': line 41, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
...is a YAML syntax error. Ansible is probably complaining about an actual syntax error in the unencrypted content (and if you're lucky, the line referenced in the error message is in fact the one with the error).

puppet can't find pip : Parameter provider failed: Invalid package provider 'pip' at < path_to_pip_file >

I have a simple .pp / puppet file, and I'm getting "Parameter provider failed: Invalid package provider 'pip' at sis.pp:24"
Here's the line 24:
20 package {"numpy":
21 ensure => installed,
22 provider => pip,
23 require => Package["python-setuptools", "python-pip", "python-dev", "build-essential"]
24 }
I checked for syntax errors, there are none.
My guess is that puppet can't find pip, I uninstalled and installed pip again. With apt-get,
here's what i get when i type "whereis pip"
pip: /usr/local/bin/pip /usr/share/man/man1/pip.1.gz
I searched around and found that puppet has a pip module, installed it too.
But still clueless about what the problem is.
When I type "puppet apply sis.pp --debug --verbose"
I get this:
debug: Puppet::Type::Package::ProviderSunfreeware: file pkg-get does not exist
debug: Puppet::Type::Package::ProviderFink: file /sw/bin/fink does not exist
debug: Puppet::Type::Package::ProviderYum: file yum does not exist
debug: Puppet::Type::Package::ProviderRug: file /usr/bin/rug does not exist
debug: Puppet::Type::Package::ProviderAix: file /usr/bin/lslpp does not exist
debug: Puppet::Type::Package::ProviderPorts: file /usr/sbin/pkg_info does not exist
debug: Puppet::Type::Package::ProviderNim: file /usr/sbin/nimclient does not exist
debug: Puppet::Type::Package::ProviderRpm: file rpm does not exist
debug: Puppet::Type::Package::ProviderSun: file /usr/sbin/pkgrm does not exist
debug: Puppet::Type::Package::ProviderPortupgrade: file /usr/sbin/pkg_info does not exist
debug: Puppet::Type::Package::ProviderHpux: file /usr/sbin/swremove does not exist
debug: Puppet::Type::Package::ProviderZypper: file /usr/bin/zypper does not exist
debug: Puppet::Type::Package::ProviderFreebsd: file /usr/sbin/pkg_delete does not exist
debug: Puppet::Type::Package::ProviderUp2date: file /usr/sbin/up2date-nox does not exist
debug: Puppet::Type::Package::ProviderPkg: file /usr/bin/pkg does not exist
debug: Puppet::Type::Package::ProviderPortage: file /usr/bin/eix does not exist
debug: Puppet::Type::Package::ProviderAptrpm: file rpm does not exist
debug: Puppet::Type::Package::ProviderOpenbsd: file pkg_delete does not exist
debug: Puppet::Type::Package::ProviderUrpmi: file urpmq does not exist
Parameter provider failed: Invalid package provider 'pip' at /path/sis.pp:54
Observe the puppet interpreter is pointing to multiple places in the sis.pp file where it couldn't process provider => "pip"
need help. I'm now going to try and find the terminal output code lines in puppet source to see what the problem is. If somebody knows the solution already, help would be appreciated.
I'm on ubuntu.
It appears your installation can't find the pip provider, rather than it not being able to find the pip executable.
I'm guessing the provider you mentioned is this one:
https://github.com/rcrowley/puppet-pip
Couple of things that might not be clear:
The plugin needs to be available on the puppet clients
Just installing the Gem won't do it for you, hence the manual env setting in the README
Probably the easiest approach is to include the puppet-pip provider in your puppet repo as a separate module, and then enable pluginsync, i.e.
[main]
pluginsync = true
More details here http://docs.puppetlabs.com/guides/plugins_in_modules.html
It looks like pip provider is not available in puppet pre 2.7 without downloading an external provider. Are you using 2.7 or higher?

Resources