summaryrefslogtreecommitdiff
path: root/ansible-practice/system
diff options
context:
space:
mode:
Diffstat (limited to 'ansible-practice/system')
-rw-r--r--ansible-practice/system/.bash_aliases9
-rw-r--r--ansible-practice/system/.bashrc38
-rw-r--r--ansible-practice/system/01-playbook-create-bash-alias.yml~0
-rw-r--r--ansible-practice/system/01-playbook-create-bash-configs.yml67
-rw-r--r--ansible-practice/system/01-playbook-create-bash-configs.yml~33
-rw-r--r--ansible-practice/system/02-playbook-copy-bash-configs.yml24
-rw-r--r--ansible-practice/system/02-playbook-copy-bash-configs.yml~60
7 files changed, 231 insertions, 0 deletions
diff --git a/ansible-practice/system/.bash_aliases b/ansible-practice/system/.bash_aliases
new file mode 100644
index 0000000..ad4cd25
--- /dev/null
+++ b/ansible-practice/system/.bash_aliases
@@ -0,0 +1,9 @@
+# navigation
+alias ls='ls --color=auto'
+alias ll='ls -al --color=auto'
+
+# applications
+alias vi=/usr/bin/vim
+
+# git
+alias gstat='git status'
diff --git a/ansible-practice/system/.bashrc b/ansible-practice/system/.bashrc
new file mode 100644
index 0000000..5d417ae
--- /dev/null
+++ b/ansible-practice/system/.bashrc
@@ -0,0 +1,38 @@
+# execute our aliases
+if [ -f ~/.bash_aliases ]; then
+. ~/.bash_aliases
+fi
+
+# history settings
+## setting unlimited filesize and history size
+export HISTFILESIZE=
+export HISTSIZE=
+export HISTCONTROL=erasedups:ignorespace:ignoredups
+
+# allows you to choose which standalone commands to drop from your history
+export HISTIGNORE='pwd:exit:fg:bg:top:clear:history:ls:uptime:ll'
+
+# display timestamp before the history command entry
+export HISTTIMEFORMAT='%F %T '
+
+# https://cyb.org.uk/2021/05/03/bash-productivity.html
+# http://mywiki.wooledge.org/BashFAQ/088
+PROMPT_COMMAND='history -a'
+shopt -s histappend
+
+#setting prompt
+# export PS1="\u@\h:\w\$ "
+# export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
+export PS1="\n\[\033[11;33m\][\[\033[11;36m\]\D{%F} \t\[\033[11;33m\]][\[\033[11;36m\]\!\[\033[11;33m\]]\n[\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00;33m\]]\[\033[00m\]\n\$ "
+export PS2="> "
+
+# the default editor
+export EDITOR=vim
+
+# add color
+eval `dircolors -b`
+
+# this function calls 'cd' to enter a directory and then immediately calls 'ls'
+cdls() {
+ cd "$@" && ll;
+}
diff --git a/ansible-practice/system/01-playbook-create-bash-alias.yml~ b/ansible-practice/system/01-playbook-create-bash-alias.yml~
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ansible-practice/system/01-playbook-create-bash-alias.yml~
diff --git a/ansible-practice/system/01-playbook-create-bash-configs.yml b/ansible-practice/system/01-playbook-create-bash-configs.yml
new file mode 100644
index 0000000..ff2156c
--- /dev/null
+++ b/ansible-practice/system/01-playbook-create-bash-configs.yml
@@ -0,0 +1,67 @@
+# creating a bash config files w/ content
+# https://phoenixnap.com/kb/ansible-create-file
+
+---
+- name: "01 - custom ansible - create bash config files w/ content"
+# hosts: all
+ hosts: localhost
+ connection: local
+ tasks:
+ - name: Creating '.bash_aliases' file with content
+ copy:
+ dest: "~/tmp/temp_files/.bash_aliases"
+ content: |
+ # navigation
+ alias ls='ls --color=auto'
+ alias ll='ls -al --color=auto'
+
+ # applications
+ alias vi=/usr/bin/vim
+
+ # git
+ alias gstat='git status'
+ tags: ['bash_aliases']
+
+ - name: Creating '.bashrc' file with content
+ copy:
+ dest: "~/tmp/temp_files/.bashrc"
+ content: |-
+ # execute our aliases
+ if [ -f ~/.bash_aliases ]; then
+ . ~/.bash_aliases
+ fi
+
+ # history settings
+ ## setting unlimited filesize and history size
+ export HISTFILESIZE=
+ export HISTSIZE=
+ export HISTCONTROL=erasedups:ignorespace:ignoredups
+
+ # allows you to choose which standalone commands to drop from your history
+ export HISTIGNORE='pwd:exit:fg:bg:top:clear:history:ls:uptime:ll'
+
+ # display timestamp before the history command entry
+ export HISTTIMEFORMAT='%F %T '
+
+ # https://cyb.org.uk/2021/05/03/bash-productivity.html
+ # http://mywiki.wooledge.org/BashFAQ/088
+ PROMPT_COMMAND='history -a'
+ shopt -s histappend
+
+ #setting prompt
+ # export PS1="\u@\h:\w\$ "
+ # export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
+ export PS1="\n\[\033[11;33m\][\[\033[11;36m\]\D{%F} \t\[\033[11;33m\]][\[\033[11;36m\]\!\[\033[11;33m\]]\n[\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00;33m\]]\[\033[00m\]\n\$ "
+ export PS2="> "
+
+ # the default editor
+ export EDITOR=vim
+
+ # add color
+ eval `dircolors -b`
+
+ # this function calls 'cd' to enter a directory and then immediately calls 'ls'
+ cdls() {
+ cd "$@" && ll;
+ }
+ tags: ['bashrc']
diff --git a/ansible-practice/system/01-playbook-create-bash-configs.yml~ b/ansible-practice/system/01-playbook-create-bash-configs.yml~
new file mode 100644
index 0000000..d968faa
--- /dev/null
+++ b/ansible-practice/system/01-playbook-create-bash-configs.yml~
@@ -0,0 +1,33 @@
+# creating a file w/ content
+# https://phoenixnap.com/kb/ansible-create-file
+
+---
+- name: "01 - custom ansible - create bash config files w/ content"
+# hosts: all
+ hosts: localhost
+ connection: local
+ tasks:
+ - name: Creating '.bash_aliases' file with content
+ copy:
+ dest: "~/tmp/temp_files/.bash_aliases"
+ content: |
+ # navigation
+ alias ls='ls --color=auto'
+ alias ll='ls -al --color=auto'
+
+ # applications
+ alias vi=/usr/bin/vim
+
+ # git
+ alias gstat='git status'
+ tags: ['bash_aliases']
+
+ - name: Creating '.bashrc' file with content
+ copy:
+ dest: "~/tmp/temp_files/.bashrc"
+ content: |
+ # execute our aliases
+ if [ -f ~/.bash_aliases ]; then
+ . ~/.bash_aliases
+ fi
+ tags: ['bashrc']
diff --git a/ansible-practice/system/02-playbook-copy-bash-configs.yml b/ansible-practice/system/02-playbook-copy-bash-configs.yml
new file mode 100644
index 0000000..ae4dd97
--- /dev/null
+++ b/ansible-practice/system/02-playbook-copy-bash-configs.yml
@@ -0,0 +1,24 @@
+# copy directories from control node to managed node
+# https://www.freekb.net/Article?id=759
+# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html
+#
+
+---
+- name: "02 - custom ansible - copy bash config files w/ content"
+# hosts: all
+ hosts: localhost
+ connection: local
+ tasks:
+ - name: copy '.bash_aliases'
+ ansible.builtin.copy:
+ src: ~/repos/ansible_repo/ansible-practice/system/.bash_aliases
+ dest: "~/tmp/temp_files/.bash_aliases"
+ mode: '0644'
+ tags: ['bash_aliases']
+
+ - name: Creating '.bashrc' file with content
+ copy:
+ src: ~/repos/ansible_repo/ansible-practice/system/.bashrc
+ dest: "~/tmp/temp_files/.bashrc"
+ mode: '0644'
+ tags: ['bashrc']
diff --git a/ansible-practice/system/02-playbook-copy-bash-configs.yml~ b/ansible-practice/system/02-playbook-copy-bash-configs.yml~
new file mode 100644
index 0000000..7ef9c07
--- /dev/null
+++ b/ansible-practice/system/02-playbook-copy-bash-configs.yml~
@@ -0,0 +1,60 @@
+# copy directories from control node to managed node
+# https://www.freekb.net/Article?id=759
+# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html
+#
+
+---
+- name: "02 - custom ansible - copy bash config files w/ content"
+# hosts: all
+ hosts: localhost
+ connection: local
+ tasks:
+ - name: copy '.bash_aliases'
+ ansible.builtin.copy:
+ src: ~/repos/ansible_repo/ansible-practice/system/.bash_aliases
+ dest: "~/tmp/temp_files/.bash_aliases"
+ tags: ['bash_aliases']
+
+ - name: Creating '.bashrc' file with content
+ copy:
+ dest: "~/tmp/temp_files/.bashrc"
+ content: |-
+ # execute our aliases
+ if [ -f ~/.bash_aliases ]; then
+ . ~/.bash_aliases
+ fi
+
+ # history settings
+ ## setting unlimited filesize and history size
+ export HISTFILESIZE=
+ export HISTSIZE=
+ export HISTCONTROL=erasedups:ignorespace:ignoredups
+
+ # allows you to choose which standalone commands to drop from your history
+ export HISTIGNORE='pwd:exit:fg:bg:top:clear:history:ls:uptime:ll'
+
+ # display timestamp before the history command entry
+ export HISTTIMEFORMAT='%F %T '
+
+ # https://cyb.org.uk/2021/05/03/bash-productivity.html
+ # http://mywiki.wooledge.org/BashFAQ/088
+ PROMPT_COMMAND='history -a'
+ shopt -s histappend
+
+ #setting prompt
+ # export PS1="\u@\h:\w\$ "
+ # export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
+ export PS1="\n\[\033[11;33m\][\[\033[11;36m\]\D{%F} \t\[\033[11;33m\]][\[\033[11;36m\]\!\[\033[11;33m\]]\n[\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00;33m\]]\[\033[00m\]\n\$ "
+ export PS2="> "
+
+ # the default editor
+ export EDITOR=vim
+
+ # add color
+ eval `dircolors -b`
+
+ # this function calls 'cd' to enter a directory and then immediately calls 'ls'
+ cdls() {
+ cd "$@" && ll;
+ }
+ tags: ['bashrc']