oliverdavies.uk/content/node.d6c8fb91-1f7d-4931-84e3-e7257a79daf2.yml

82 lines
3.4 KiB
YAML

uuid:
- value: d6c8fb91-1f7d-4931-84e3-e7257a79daf2
langcode:
- value: en
type:
- target_id: daily_email
target_type: node_type
target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7
revision_timestamp:
- value: '2025-05-11T09:00:55+00:00'
revision_uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
revision_log: { }
status:
- value: true
uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
title:
- value: 'Using Ansible for local environment configuration'
created:
- value: '2022-09-05T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:55+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2022/09/05/using-ansible-for-local-configuration
langcode: en
body:
- value: |
<p>As well as <a href="/daily/2022/09/04/using-ansible-for-server-configuration">configuring servers</a>, you can use Ansible to configure your own local machine and development environment.</p>
<p>The change that you need to make is within the <code>hosts.ini</code> file:</p>
<pre><code>127.0.0.1 ansible_connection=local
</code></pre>
<p>Instead of the server's IP address or hostname, use the localhost IP address and set <code>ansible_connection</code> to <code>local</code> to tell Ansible to run locally instead of using an SSH connection.</p>
<p>Another way to do this is to set <code>hosts: 127.0.0.1</code> and <code>connection: true</code> in your playbook.</p>
<p>Once this is done, you can run tasks, roles, and collections to automate tasks such as installing software, adding your SSH keys, configuring your project directories, and anything else that you need to do.</p>
<p>For an example of this, you can see <a href="https://github.com/opdavies/dotfiles">my dotfiles repository on GitHub</a>.</p>
<hr />
<p>Want to learn more about how I use Ansible? <a href="/ansible-course">Register for my upcoming free email course</a>.</p>
format: full_html
processed: |
<p>As well as <a href="http://default/daily/2022/09/04/using-ansible-for-server-configuration">configuring servers</a>, you can use Ansible to configure your own local machine and development environment.</p>
<p>The change that you need to make is within the <code>hosts.ini</code> file:</p>
<pre><code>127.0.0.1 ansible_connection=local
</code></pre>
<p>Instead of the server's IP address or hostname, use the localhost IP address and set <code>ansible_connection</code> to <code>local</code> to tell Ansible to run locally instead of using an SSH connection.</p>
<p>Another way to do this is to set <code>hosts: 127.0.0.1</code> and <code>connection: true</code> in your playbook.</p>
<p>Once this is done, you can run tasks, roles, and collections to automate tasks such as installing software, adding your SSH keys, configuring your project directories, and anything else that you need to do.</p>
<p>For an example of this, you can see <a href="https://github.com/opdavies/dotfiles">my dotfiles repository on GitHub</a>.</p>
<hr>
<p>Want to learn more about how I use Ansible? <a href="http://default/ansible-course">Register for my upcoming free email course</a>.</p>
summary: null
field_daily_email_cta: { }