guess what... I didn't change a thing, and about an hour later it worked. Wha...?
On Mon, Sep 13, 2021 at 12:49 PM Amedee Van Gasse <[email protected]> wrote: > I am writing an Ansible playbook to quickly install and configure a local > laptop. I have tested it on my local machine with ansible-playbook > local.yml --ask-become-pass and in a Vagrant box with vagrant provision, > and that works perfectly. (please keep reading) > > > local.yml > > --- > - hosts: all > roles: > - common > - development > connection: local > become: yes > ... > > > ansible.cfg > > [defaults] > INVENTORY = inventory.yml > INTERPRETER_PYTHON = auto > LOCALHOST_WARNING = False > > > inventory.yml > > --- > all: > children: > ungrouped: > hosts: > default: > ansible_connection: local > ... > > > Vagrantfile > > Vagrant.configure("2") do |config| > > config.vm.box = "ubuntu/focal64" > > config.vm.provision "ansible_local" do |ansible| > ansible.playbook = "local.yml" > end > > end > > > Now I want to add a GitHub Action to use GitHub as a CI for my changes, by > running my playbook on the latest Ubuntu version inside a container. See > GitHub Marketplace: > https://github.com/marketplace/actions/check-ansible-ubuntu-latest > > > .github/workflows/ansible-ubuntu-latest.yml > > name: Ansible check ubuntu:latest > > on: [push, pull_request] > > jobs: > build: > > runs-on: ubuntu-latest > > steps: > - uses: actions/checkout@v2 > > - name: ansible check with ubuntu:latest > uses: roles-ansible/check-ansible-ubuntu-latest-action@master > with: > targets: "local.yml" > hosts: "localhost" > > > However, the playbook doesn't run in GitHub Actions. > > This is the relevant part of the log where I think the issue occurs: > > Warning: : Unable to parse /github/workspace/host.ini as an inventory > source > Warning: : No inventory was parsed, only implicit localhost is available > Warning: : provided hosts list is empty, only localhost is available. Note > that > the implicit localhost does not match 'all' > > PLAY [all] > ********************************************************************* > skipping: no hosts matched > > PLAY RECAP > ********************************************************************* > > > Please note that I have no host.ini, I have a inventory.yml instead. > > This is the full log of that build step: > > > Run roles-ansible/check-ansible-ubuntu-latest-action@master > /usr/bin/docker run --name b361ed873671b7a624a4eaa4c28615bfd1d98_4e9c36 > --label 7b361e --workdir /github/workspace --rm -e INPUT_TARGETS -e > INPUT_HOSTS -e INPUT_GROUP -e INPUT_REQUIREMENTS -e TARGETS -e HOSTS -e > GROUP -e REQUIREMENTS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e > GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e > GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e > GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME > -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e > GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e > GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV > -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e > ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e > GITHUB_ACTIONS=true -e CI=true -v > "/var/run/docker.sock":"/var/run/docker.sock" -v > "/home/runner/work/_temp/_github_home":"/github/home" -v > "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v > "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v > "/home/runner/work/ansible-workstation/ansible-workstation":"/github/workspace" > 7b361e:d873671b7a624a4eaa4c28615bfd1d98 > + git submodule update --init --recursive > + [[ '' == *.yml ]] > + '[' '!' -z '' ']' > + '[' /ansible-docker.sh = /ansible-docker.sh ']' > + echo -E '\nRunning Ansible debian check...\n' > \nRunning Ansible debian check...\n > + ansible::prepare > + : local.yml > + : /github/workspace > + pushd /github/workspace > /github/workspace /github/workspace > + tee ansible.cfg > + echo -e ' > [defaults] > inventory = host.ini > nocows = True > host_key_checking = False > forks = 20 > fact_caching = jsonfile > fact_caching_connection = /github/home/facts > fact_caching_timeout = 7200 > stdout_callback = yaml > ansible_python_interpreter=/usr/bin/python3 > ansible_connection=local > ' > > [defaults] > inventory = host.ini > nocows = True > host_key_checking = False > forks = 20 > fact_caching = jsonfile > fact_caching_connection = /github/home/facts > fact_caching_timeout = 7200 > stdout_callback = yaml > ansible_python_interpreter=/usr/bin/python3 > ansible_connection=local > > + echo -e '[local]\nlocalhost ansible_python_interpreter=/usr/bin/python3 > ansible_connection=local' > + tee host.ini > [local] > localhost ansible_python_interpreter=/usr/bin/python3 > ansible_connection=local > + [[ local.yml == *.yml ]] > > + echo -e '\nansible playbook detected\ninitialize playbook testing...\n' > ansible playbook detected > initialize playbook testing... > > /github/workspace /github/workspace /github/workspace > + ansible::test::playbook > + : local.yml > + : /github/workspace > + : localhost > + : '' > + pushd /github/workspace > + echo -e '[]\nlocalhost ansible_python_interpreter=/usr/bin/python3 > ansible_connection=local ansible_host=127.0.0.1' > + tee host.ini > + ansible-playbook --connection=local --inventory host.ini local.yml > [] > localhost ansible_python_interpreter=/usr/bin/python3 > ansible_connection=local ansible_host=127.0.0.1 > Warning: : * Failed to parse /github/workspace/host.ini with ini plugin: > /github/workspace/host.ini:1: Invalid section entry: '[]'. Please make sure > that there are no spaces in the section entry, and that there are no other > invalid characters > Warning: : Unable to parse /github/workspace/host.ini as an inventory > source > Warning: : No inventory was parsed, only implicit localhost is available > Warning: : provided hosts list is empty, only localhost is available. Note > that > the implicit localhost does not match 'all' > > PLAY [all] > ********************************************************************* > skipping: no hosts matched > > PLAY RECAP > ********************************************************************* > > > What do I need to change to make sure that my playbook runs in GitHub > actions? > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ansible-project/RUKuWFTQdV4/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/f3153033-d601-4a74-ad13-56af0eebeaa2n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/f3153033-d601-4a74-ad13-56af0eebeaa2n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CALhozi87qO7i0ryG4Dh2umCPcGcFr1%2B0Prqu0dFoeBZRX_9H0Q%40mail.gmail.com.
