Managing Files, Directories and Links
You can use Ignition to create, replace or update files, directories or links.
This example creates a directory with the default mode (set to
and recurseable by all), and writable only by the owner (by default
variant: fcos version: 1.4.0 storage: directories: - path: /opt/tools overwrite: true
This example creates a file named
/var/helloworld with some content defined
in-line. It also sets the file mode to
0644 (readable by all, writable by the
owner) and sets owernship to
variant: fcos version: 1.4.0 storage: files: - path: /var/helloworld overwrite: true contents: inline: Hello, world! mode: 0644 user: name: dnsmasq group: name: dnsmasq
This example creates a file with its content fetched from a remote location. In
this case, it fetches an HTTPS URL and expects the file to be compressed with
gzip and will decompress it before writting it on the disk. The decompressed
content is checked against the hash value specified in the config. The format
sha512- followed by the 128 hex characters given by the sha512sum command.
The resulting file is made readable and executable by all.
variant: fcos version: 1.4.0 storage: files: - path: /opt/tools/transmogrifier overwrite: true contents: source: https://mytools.example.com/path/to/archive.gz compression: gzip verification: hash: sha512-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 mode: 0555
This example creates a symbolic link in
/usr/local/bin to a path in
This is useful to let local processes invoke a program without altering their
PATH environment variable.
variant: fcos version: 1.4.0 storage: links: - path: /usr/local/bin/transmogrifier overwrite: true target: /opt/tools/transmogrifier hard: false
If you need a directory and some of its parents to be owned by a specific user, you currently have to explicitly list them in your Butane config. See butane#380 for the tracking issue in Butane for a future better syntax for this case.
variant: fcos version: 1.4.0 storage: files: - path: /home/builder/.config user: name: builder group: name: builder - path: /home/builder/.config/systemd user: name: builder group: name: builder - path: /home/builder/.config/systemd/user user: name: builder group: name: builder - path: /home/builder/.config/systemd/user/default.target.wants user: name: builder group: name: builder - path: /home/builder/.config/systemd/user/timers.target.wants user: name: builder group: name: builder - path: /home/builder/.config/systemd/user/sockets.target.wants user: name: builder group: name: builder
Want to help? Learn how to contribute to Fedora Docs ›