website-toots/111093609530864980.md

7 lines
2.3 KiB
Markdown
Raw Normal View History

2023-09-19 19:19:00 -04:00
---
{"id": "111093609530864980", "in_reply_to_id": null, "in_reply_to_account_id": null, "sensitive": false, "spoiler_text": "", "visibility": "public", "language": "en", "replies_count": 0, "reblogs_count": 0, "favourites_count": 1, "edited_at": null, "reblog": null, "application": null, "account": {"id": "108219415927856966", "username": "brozek", "acct": "brozek", "display_name": "Brandon Rozek", "url": "https://fosstodon.org/@brozek", "avatar": "https://cdn.fosstodon.org/accounts/avatars/108/219/415/927/856/966/original/bae9f46f23936e79.jpg", "avatar_static": "https://cdn.fosstodon.org/accounts/avatars/108/219/415/927/856/966/original/bae9f46f23936e79.jpg", "header": "https://fosstodon.org/headers/original/missing.png", "header_static": "https://fosstodon.org/headers/original/missing.png", "noindex": true, "roles": []}, "media_attachments": [], "mentions": [], "tags": [], "emojis": [], "card": {"url": "https://kkovacs.eu/ansible-lineinfile-blockinfile-in-bash/", "title": "Poor man's Ansible: lineinfile and blockinfile in bash", "description": "Two of my favorite functions in Ansible are lineinfile and blockinfile. They are extraordinarily useful when one needs to ensure that a line or a block is either replaced or put in a config file.\nlineinfile # For example, let's say one wants to enable IP forwarding in the sysctl, one can write the following task in Ansible:\n- name: Enable IP forwarding lineinfile: dest: /etc/sysctl.conf regexp: \"net.ipv4.ip_forward\" line: \"net.ipv4.ip_forward=1\" state: present What exactly this task does is:", "type": "link", "author_name": "", "author_url": "", "provider_name": "", "provider_url": "", "html": "", "width": 0, "height": 0, "image": null, "embed_url": "", "blurhash": null}, "poll": null, "syndication": "https://fosstodon.org/@brozek/111093609530864980", "date": "2023-09-19T20:05:54.023Z"}
---
{{< unsafe >}}
<p>Kristof Kovacs wrote a script that emulates lineinfile from Ansible.</p><p>Now I don&#39;t need to open up a whole text editor to edit one line in a configuration file. </p><p><a href="https://kkovacs.eu/ansible-lineinfile-blockinfile-in-bash/" target="_blank" rel="nofollow noopener noreferrer"><span class="invisible">https://</span><span class="ellipsis">kkovacs.eu/ansible-lineinfile-</span><span class="invisible">blockinfile-in-bash/</span></a></p>
{{< /unsafe >}}