# Ansible getting started official doc not working

**URL:** <https://forum.ansible.com/t/ansible-getting-started-official-doc-not-working/45860>\
**Category:** Get Help\
**Tags:** getting-started\
**Created:** [May 28, 2026, 1:23pm UTC](https://forum.ansible.com/t/ansible-getting-started-official-doc-not-working/45860 "2026-05-28T13:23:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Latomate](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/latomate/32/9741_2.png) [@Latomate](https://forum.ansible.com/u/Latomate)\
**Post date:** [May 28, 2026, 1:23pm UTC](https://forum.ansible.com/t/ansible-getting-started-official-doc-not-working/45860/1 "2026-05-28T13:23:09Z")

</div>

I’m learning Ansible thanks of the official documentation: [Building an inventory — Ansible Community Documentation](https://docs.ansible.com/projects/ansible/latest/getting_started/get_started_inventory.html)

the step 4: “Ping the `myhosts` group in your inventory” is not working for me  
`ansible myhosts -m ping -i inventory.ini`

returns me:

```auto
server | UNREACHABLE! => {
    "changed": false,
    "msg": "Task failed: Failed to connect to the host via ssh: Host key verification failed.",
    "unreachable": true
}

```

but I can ping manually the “server” host, and I can connect with ssh on it thanks to the authorized\_keys.

My server Dockerfile:

```auto
FROM alpine

RUN apk add openssh

RUN ssh-keygen -A

RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh

COPY authorized_keys /root/.ssh/authorized_keys

CMD ["/usr/sbin/sshd", "-D"]

```

My ansible dockerfile:

```auto
FROM alpine/ansible:latest

RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh

COPY .ssh /root/.ssh

COPY ansible_project ansible_project

WORKDIR /ansible_project

RUN chmod 600 /root/.ssh/id_rsa && chmod 644 /root/.ssh/id_rsa.pub

CMD ["tail", "-f", "/dev/null"]

```

Did the tutorial forgot to tell any configuration steps ?

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [May 28, 2026, 2:26pm UTC](https://forum.ansible.com/t/ansible-getting-started-official-doc-not-working/45860/2 "2026-05-28T14:26:30Z")

</div>

The `ping` module does not do an `icmp` ping, it is a round trip test, that among other things validates that it can SSH to the host.

The error you are getting states:

```auto
Host key verification failed

```

This means the local ssh client likely has an SSH host key stored for the server that no longer matches what the server is configured to use.

---

<div class="post-metadata">

**Author:** ![Latomate](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/latomate/32/9741_2.png) [@Latomate](https://forum.ansible.com/u/Latomate)\
**Post date:** [May 28, 2026, 2:36pm UTC](https://forum.ansible.com/t/ansible-getting-started-official-doc-not-working/45860/3 "2026-05-28T14:36:56Z")

</div>

After reading more documentation, my new ansible Dockerfile is this:

```auto
FROM python

RUN adduser ansible

USER ansible

COPY --chown=ansible .ssh /home/ansible/.ssh

RUN chmod 700 /home/ansible/.ssh && \
    chmod 600 /home/ansible/.ssh/id_rsa && \
    chmod 644 /home/ansible/.ssh/id_rsa.pub

RUN python3 -m pip install --user pipx && \
    python3 -m pipx ensurepath

RUN ~/.local/bin/pipx install --include-deps ansible

COPY ansible_project ansible_project

WORKDIR /ansible_project

CMD ["tail", "-f", "/dev/null"]

```

I still have to register the host in the known\_host which I need to find a way to automatise.

With this Dockerfile the error is now:

```auto
server | UNREACHABLE! => {
    "changed": false,
    "msg": "Task failed: Failed to connect to the host via ssh: ansible@server: Permission denied (publickey,password,keyboard-interactive).",
    "unreachable": true
}

```

Then by installing python3 on the host and specify `-u root` on the ansible command, it works.

The official “Getting Starter” should add those information to be aimed at beginners

---

<div class="post-metadata">

**Author:** ![Latomate](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/latomate/32/9741_2.png) [@Latomate](https://forum.ansible.com/u/Latomate)\
**Post date:** [May 28, 2026, 3:05pm UTC](https://forum.ansible.com/t/ansible-getting-started-official-doc-not-working/45860/4 "2026-05-28T15:05:21Z")

</div>

I didn’t know what happened, anyway with a not root user it seems to work better. I’m not familiar with ssh at the moment

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [May 28, 2026, 3:06pm UTC](https://forum.ansible.com/t/ansible-getting-started-official-doc-not-working/45860/5 "2026-05-28T15:06:51Z")

</div>

> [@Latomate](#):
>
> I still have to register the host in the known\_host which I need to find a way to automatise.

This might not be the best example as the role is very old and needs a re-write but the [SSH role](https://git.coop/webarch/ssh) I have written generates `known_hosts` and other SSH config files, an example output is this repo:

> **[webarch / Webarchitects SSH Fingerprints · GitLab](https://git.coop/webarch/webarch-ssh)**
>
> SSH fingerprints for Webarchitects Co-operative servers

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [June 27, 2026, 3:07pm UTC](https://forum.ansible.com/t/ansible-getting-started-official-doc-not-working/45860/6 "2026-06-27T15:07:40Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
