ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14.04k stars 3.42k forks source link

When trying to run the installer on MacOS (Catalina) the installer tries to use powershell to gather facts #7781

Open spam-n-eggs opened 4 years ago

spam-n-eggs commented 4 years ago

Issues are for concrete, actionable bugs and feature requests only - if you're just asking for debugging help or technical support, please use:

We have to limit this because of limited volunteer time to respond to issues!

ISSUE TYPE
SUMMARY

Running the installer tries to run powershell to gather facts, even if when using bash or zsh.

ENVIRONMENT
STEPS TO REPRODUCE
  1. Set up as in the attached inventory
  2. Run ansible-playbook -i inventory install.yml
EXPECTED RESULTS

The playbook will build the AWX Server completely

ACTUAL RESULTS

Ansible errors out:

┌[kiwish-4.2]-(awx/installer)-[git:13_installer*]-[71%]
└> ansible-playbook -u markh --ask-become-pass -i inventory install.yml -vvv
ansible-playbook 2.9.11
  config file = /Users/mhorninger/projects/dominion-solutions/awx/installer/ansible.cfg
  configured module search path = ['/Users/mhorninger/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)]
Using /Users/mhorninger/projects/dominion-solutions/awx/installer/ansible.cfg as config file
BECOME password: 
host_list declined parsing /Users/mhorninger/projects/dominion-solutions/awx/installer/inventory as it did not pass its verify_file() method
script declined parsing /Users/mhorninger/projects/dominion-solutions/awx/installer/inventory as it did not pass its verify_file() method
auto declined parsing /Users/mhorninger/projects/dominion-solutions/awx/installer/inventory as it did not pass its verify_file() method
Parsed /Users/mhorninger/projects/dominion-solutions/awx/installer/inventory inventory source with ini plugin
statically imported: /Users/mhorninger/projects/dominion-solutions/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml
[DEPRECATION WARNING]: docker_service is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about this rationale.. This feature will be removed in a future release. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
statically imported: /Users/mhorninger/projects/dominion-solutions/awx/installer/roles/local_docker/tasks/set_image.yml
statically imported: /Users/mhorninger/projects/dominion-solutions/awx/installer/roles/local_docker/tasks/compose.yml

PLAYBOOK: install.yml ****************************************************************************************************************************************************************************************************************************************************************
1 plays in install.yml

PLAY [Build and deploy AWX] **********************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************************************************************************
task path: /Users/mhorninger/projects/dominion-solutions/awx/installer/install.yml:2
<192.168.88.10> ESTABLISH SSH CONNECTION FOR USER: markh
<192.168.88.10> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="markh"' -o ConnectTimeout=10 -o ControlPath=/Users/mhorninger/.ansible/cp/ad227640a4 192.168.88.10 '/usr/bin/env sh -c '"'"'echo ~markh && sleep 0'"'"''
<192.168.88.10> (0, b'/home/markh\n', b'')
<192.168.88.10> ESTABLISH SSH CONNECTION FOR USER: markh
<192.168.88.10> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="markh"' -o ConnectTimeout=10 -o ControlPath=/Users/mhorninger/.ansible/cp/ad227640a4 192.168.88.10 '/usr/bin/env sh -c '"'"'( umask 77 && mkdir -p "` echo /home/markh/.ansible/tmp `"&& mkdir /home/markh/.ansible/tmp/ansible-tmp-1596146711.863554-7419-192905090132564 && echo ansible-tmp-1596146711.863554-7419-192905090132564="` echo /home/markh/.ansible/tmp/ansible-tmp-1596146711.863554-7419-192905090132564 `" ) && sleep 0'"'"''
<192.168.88.10> (0, b'ansible-tmp-1596146711.863554-7419-192905090132564=/home/markh/.ansible/tmp/ansible-tmp-1596146711.863554-7419-192905090132564\n', b'')
Using module file /usr/local/lib/python3.8/site-packages/ansible/modules/~indows/setup.ps1
<192.168.88.10> PUT /Users/mhorninger/.ansible/tmp/ansible-local-7414h1gg4dh5/tmp0y39g0t5 TO /home/markh/.ansible/tmp/ansible-tmp-1596146711.863554-7419-192905090132564/AnsiballZ_setup.ps1
<192.168.88.10> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="markh"' -o ConnectTimeout=10 -o ControlPath=/Users/mhorninger/.ansible/cp/ad227640a4 '[192.168.88.10]'
<192.168.88.10> (0, b'sftp> put /Users/mhorninger/.ansible/tmp/ansible-local-7414h1gg4dh5/tmp0y39g0t5 /home/markh/.ansible/tmp/ansible-tmp-1596146711.863554-7419-192905090132564/AnsiballZ_setup.ps1\n', b'')
<192.168.88.10> ESTABLISH SSH CONNECTION FOR USER: markh
<192.168.88.10> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="markh"' -o ConnectTimeout=10 -o ControlPath=/Users/mhorninger/.ansible/cp/ad227640a4 192.168.88.10 '/usr/bin/env sh -c '"'"'chmod u+x /home/markh/.ansible/tmp/ansible-tmp-1596146711.863554-7419-192905090132564/ /home/markh/.ansible/tmp/ansible-tmp-1596146711.863554-7419-192905090132564/AnsiballZ_setup.ps1 && sleep 0'"'"''
<192.168.88.10> (0, b'', b'')
<192.168.88.10> ESTABLISH SSH CONNECTION FOR USER: markh
<192.168.88.10> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="markh"' -o ConnectTimeout=10 -o ControlPath=/Users/mhorninger/.ansible/cp/ad227640a4 -tt 192.168.88.10 '/usr/bin/env sh -c '"'"'powershell /home/markh/.ansible/tmp/ansible-tmp-1596146711.863554-7419-192905090132564/AnsiballZ_setup.ps1 && sleep 0'"'"''
<192.168.88.10> (127, b'sh: powershell: not found\r\n', b'Shared connection to 192.168.88.10 closed.\r\n')
<192.168.88.10> Failed to connect to the host via ssh: Shared connection to 192.168.88.10 closed.
<192.168.88.10> ESTABLISH SSH CONNECTION FOR USER: markh
<192.168.88.10> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="markh"' -o ConnectTimeout=10 -o ControlPath=/Users/mhorninger/.ansible/cp/ad227640a4 192.168.88.10 '/usr/bin/env sh -c '"'"'rm -f -r /home/markh/.ansible/tmp/ansible-tmp-1596146711.863554-7419-192905090132564/ > /dev/null 2>&1 && sleep 0'"'"''
<192.168.88.10> (0, b'', b'')
fatal: [192.168.88.10]: FAILED! => {
    "ansible_facts": {},
    "changed": false,
    "failed_modules": {
        "setup": {
            "failed": true,
            "module_stderr": "Shared connection to 192.168.88.10 closed.\r\n",
            "module_stdout": "sh: powershell: not found\r\n",
            "msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error",
            "rc": 127
        }
    },
    "msg": "The following modules failed to execute: setup\n"
}

PLAY RECAP ***************************************************************************************************************************************************************************************************************************************************************************
192.168.88.10              : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0 
ADDITIONAL INFORMATION

Inventory file:

#localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python3" gather_facts=false
192.168.88.10 ansible_python_interpreter="/usr/bin/python3"

[all:vars]

# Remove these lines if you want to run a local image build
# Otherwise the setup playbook will install the official Ansible images. Versions may
# be selected based on: latest, 1, 1.0, 1.0.0, 1.0.0.123
# by default the base will be used to search for ansible/awx
dockerhub_base=ansible
dockerhub_version=13.0.0

# Common Docker parameters
awx_task_hostname=awx
awx_web_hostname=awxweb
postgres_data_dir="/opt/awx/postgres"
host_port=80
host_port_ssl=443
#ssl_certificate=
# Optional key file
#ssl_certificate_key=
docker_compose_dir="~/.awx/awxcompose"

# Required for Openshift when building the image on your own
# Optional for Openshift if using Dockerhub or another prebuilt registry
# Required for Docker Compose Install if building the image on your own
# Optional for Docker Compose Install if using Dockerhub or another prebuilt registry
# Define if you want the image pushed to a registry. The container definition will also use these images
# docker_registry=172.30.1.1:5000
# docker_registry_repository=awx
# docker_registry_username=developer

# Set pg_hostname if you have an external postgres server, otherwise
# a new postgres service will be created
# pg_hostname=postgresql
pg_username=awx
# pg_password should be random 10 character alphanumeric string, when postgresql is running on kubernetes
# NB: it's a limitation of the "official" postgres helm chart
pg_password=3emoJLigId
pg_database=awx
pg_port=5432
#pg_sslmode=require

# The following variable is only required when using the provided
# containerized postgres deployment on OpenShift
# pg_admin_password=postgrespass

# Use a local distribution build container image for building the AWX package
# This is helpful if you don't want to bother installing the build-time dependencies as
# it is taken care of already.
# NOTE: IMPORTANT: If you are running a mininshift install, using this container might not work
#                  if you are using certain drivers like KVM where the source tree can't be mapped
#                  into the build container.
#                  Thus this setting must be set to False which will trigger a local build. To view the
#                  typical dependencies that you might need to install see:
#                  installer/image_build/files/Dockerfile.sdist
# use_container_for_build=true

# This will create or update a default admin (superuser) account in AWX, if not provided
# then these default values are used
admin_user=admin
admin_password=DxsYms3ceF

# Whether or not to create preload data for demonstration purposes
create_preload_data=True

# AWX Secret key
# It's *very* important that this stay the same between upgrades or you will lose the ability to decrypt
# your credentials
secret_key=Aw5mRtzIHO

# Build AWX with official logos
# Requires cloning awx-logos repo as a sibling of this project.
# Review the trademark guidelines at https://github.com/ansible/awx-logos/blob/master/TRADEMARKS.md
awx_official=true

# Proxy
#http_proxy=http://proxy:3128
#https_proxy=http://proxy:3128
#no_proxy=mycorp.org

# Container networking configuration
# Set the awx_task and awx_web containers' search domain(s)
#awx_container_search_domains=example.com,ansible.com
# Alternate DNS servers
#awx_alternate_dns_servers="10.1.2.3,10.2.3.4"

# AWX project data folder. If you need access to the location where AWX stores the projects
# it manages from the docker host, you can set this to turn it into a volume for the container.
#project_data_dir=/var/lib/awx/projects

# AWX custom virtual environment folder. Only usable for local install.
#custom_venv_dir=/opt/my-envs/

# CA Trust directory. If you need to provide custom CA certificates, supplying
# this variable causes this directory on the host to be bind mounted over
# /etc/pki/ca-trust in the awx_task and awx_web containers.
# If you are deploying on openshift or kubernetes, set the variable to /etc/pki/ca-trust instead,
# as the awx_web and awx_task containers will not run the `update-ca-trust` command.
#ca_trust_dir=/etc/pki/ca-trust/source/anchors

# Include /etc/nginx/awx_extra.conf
# Note the use of glob pattern for nginx
# which makes include "optional" - i.e. not fail
# if file is absent
#extra_nginx_include="/etc/nginx/awx_extra[.]conf"

# Docker compose explicit subnet. Set to avoid overlapping your existing LAN networks.
#docker_compose_subnet="172.17.0.1/16"
#
# Allow for different docker logging drivers
# By Default; the logger will be json-file, however you can override
# that by uncommenting the docker_logger below.
# Be aware that journald may rate limit your log messages if you choose it.
# See: https://docs.docker.com/config/containers/logging/configure/
# docker_logger=journald
ryanpetrello commented 4 years ago

@geerlingguy did you run into this recently in your OSX installs? You have any idea what's going on here?

geerlingguy commented 4 years ago

I never had this issue. It looks like in the inventory file the localhost line was commented out (the one that would use a local connection instead of trying SSH or powershell...). Is that a change from the default?

spam-n-eggs commented 4 years ago

@geerlingguy I've tried it both ways - with the local connection and the connection to a remote server and I get the exact same result.

This is the output from running locally:

┌[kiwish-4.2]-(awx/installer)-[git:13_installer*]-[98%]
└> ansible-playbook -i inventory install.yml -vvv
ansible-playbook 2.9.10
  config file = /Users/mhorninger/projects/dominion-solutions/awx/installer/ansible.cfg
  configured module search path = ['/Users/mhorninger/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)]
Using /Users/mhorninger/projects/dominion-solutions/awx/installer/ansible.cfg as config file
host_list declined parsing /Users/mhorninger/projects/dominion-solutions/awx/installer/inventory as it did not pass its verify_file() method
script declined parsing /Users/mhorninger/projects/dominion-solutions/awx/installer/inventory as it did not pass its verify_file() method
auto declined parsing /Users/mhorninger/projects/dominion-solutions/awx/installer/inventory as it did not pass its verify_file() method
Parsed /Users/mhorninger/projects/dominion-solutions/awx/installer/inventory inventory source with ini plugin
statically imported: /Users/mhorninger/projects/dominion-solutions/awx/installer/roles/local_docker/tasks/upgrade_postgres.yml
[DEPRECATION WARNING]: docker_service is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about this rationale.. This feature will be removed in a future release. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
statically imported: /Users/mhorninger/projects/dominion-solutions/awx/installer/roles/local_docker/tasks/set_image.yml
statically imported: /Users/mhorninger/projects/dominion-solutions/awx/installer/roles/local_docker/tasks/compose.yml

PLAYBOOK: install.yml ****************************************************************************************************************************************************************************************************************************************************************
1 plays in install.yml

PLAY [Build and deploy AWX] **********************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************************************************************************
task path: /Users/mhorninger/projects/dominion-solutions/awx/installer/install.yml:2
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: mhorninger
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /tmp/ansible `"&& mkdir /tmp/ansible/ansible-tmp-1596209449.150903-16156-177182478479684 && echo ansible-tmp-1596209449.150903-16156-177182478479684="` echo /tmp/ansible/ansible-tmp-1596209449.150903-16156-177182478479684 `" ) && sleep 0'
Using module file /usr/local/lib/python3.8/site-packages/ansible/modules/~indows/setup.ps1
<localhost> PUT /Users/mhorninger/.ansible/tmp/ansible-local-16152iuj3q2lf/tmpa9xi9943 TO /private/tmp/ansible/ansible-tmp-1596209449.150903-16156-177182478479684/AnsiballZ_setup.ps1
<localhost> EXEC /bin/sh -c 'chmod u+x /tmp/ansible/ansible-tmp-1596209449.150903-16156-177182478479684/ /tmp/ansible/ansible-tmp-1596209449.150903-16156-177182478479684/AnsiballZ_setup.ps1 && sleep 0'
<localhost> EXEC /bin/sh -c 'powershell /tmp/ansible/ansible-tmp-1596209449.150903-16156-177182478479684/AnsiballZ_setup.ps1 && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /tmp/ansible/ansible-tmp-1596209449.150903-16156-177182478479684/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "ansible_facts": {},
    "changed": false,
    "failed_modules": {
        "setup": {
            "failed": true,
            "module_stderr": "/bin/sh: powershell: command not found\n",
            "module_stdout": "",
            "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
            "rc": 127
        }
    },
    "msg": "The following modules failed to execute: setup\n"
}

PLAY RECAP ***************************************************************************************************************************************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

And the local inventory (i cleaned up the commented-out sets for brevity's sake):

localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python3"

[all:vars]

# Remove these lines if you want to run a local image build
# Otherwise the setup playbook will install the official Ansible images. Versions may
# be selected based on: latest, 1, 1.0, 1.0.0, 1.0.0.123
# by default the base will be used to search for ansible/awx
dockerhub_base=ansible
dockerhub_version=13.0.0

# Common Docker parameters
awx_task_hostname=awx
awx_web_hostname=awxweb
postgres_data_dir="/opt/awx/postgres"
host_port=80
host_port_ssl=443
docker_compose_dir="~/.awx/awxcompose"

# Set pg_hostname if you have an external postgres server, otherwise
# a new postgres service will be created
# pg_hostname=postgresql
pg_username=awx
# pg_password should be random 10 character alphanumeric string, when postgresql is running on kubernetes
# NB: it's a limitation of the "official" postgres helm chart
pg_password=3emoJLigId
pg_database=awx
pg_port=5432

# The following variable is only required when using the provided
# containerized postgres deployment on OpenShift
# pg_admin_password=postgrespass

# This will create or update a default admin (superuser) account in AWX, if not provided
# then these default values are used
admin_user=admin
admin_password=DxsYms3ceF

# Whether or not to create preload data for demonstration purposes
create_preload_data=True

# AWX Secret key
# It's *very* important that this stay the same between upgrades or you will lose the ability to decrypt
# your credentials
secret_key=Aw5mRtzIHO

# Build AWX with official logos
# Requires cloning awx-logos repo as a sibling of this project.
# Review the trademark guidelines at https://github.com/ansible/awx-logos/blob/master/TRADEMARKS.md
awx_official=true
spam-n-eggs commented 4 years ago

Interestingly, if I add an executable line to my ansible.cfg, this issue goes away and a whole new one shows up where ansible is trying to write to ~/.ansible/tmp and cannot.