Skip to main content

An easy solution for system/dotfile configuration

Project description

instater

An easy solution for system/dotfile configuration

Loosely based off of Ansible for the task and file organization

Installation

pip3 install instater

Usage

See the File Structure Example below to set up variables, files, and tasks.

Once a setup.yml file is created, it can be run using

instater

# or:
instater --setup-file setup.yml

To see what changed will be made, but not actually make then, use --dry-run:

instater --dry-run

For a complete example, see dotfiles

File Structure Example

First, create a setup.yml file:

# Lots of ways to prompt for data at the beginning of execution
vars_prompt:
- name: my_var
- name: custom_prompt
  prompt: Enter something here
- name: private_var
  private: true
- name: private_confirm_var
  private: true
  confirm: true
- name: allow_empty_var
  allow_empty: true

# variables that can be used within tasks/files can be populated
# from a static file, in this case vars/common.yml
vars_files:
- vars/common.yml
# variables can be used within the file names
- "vars/{{ vars_file }}.yml"

# All of the tasks to perform are enumerated
tasks:
- name: Copy file
  # {{ username }} is replaced with the variable `username`
  copy:
    content: "The contents of a new file in here"
    dest: "/home/{{ username }}/Downloads/file1"
    mode: "600"
  # if desired, the output of this task can be registered to use as
  # a condition for subsequent tasks
  register: file1_copy
- name: Run a command if file1 written
  command: "touch /home/{{ username }}/testfile"
  when: file1_copy.changed

Then, create a vars/ directory and common.yml within:

my_test: 1
some_var: "{{ my_test + 2 }}"
vars_file: "second"
username: something

And vars/second.yml (since common.yml set vars_file to second):

from_second_yml: data in here

Now in all of the tasks, my_test, username, from_second_yml, etc will be present and accessible.

Tasks

All currently defined tasks are listed below

aur

command

copy

debug

directory

file

get_url (alias of copy)

git

group

include

pacman

service

template (alias of copy)

user

Changelog

0.1.0 2021-07-29

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

instater-0.1.0.tar.gz (8.2 kB view hashes)

Uploaded Source

Built Distribution

instater-0.1.0-py3-none-any.whl (10.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page