PowerShell can be installed on Linux
This commit is contained in:
parent
92e1b2cca3
commit
bd95a6df37
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.retry
|
32
README.md
32
README.md
@ -1 +1,33 @@
|
|||||||
# Ansible
|
# Ansible
|
||||||
|
|
||||||
|
First things first, install ansible
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get install ansible
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
[doc](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-configuration-settings-locations)
|
||||||
|
|
||||||
|
The configuration file
|
||||||
|
Changes can be made and used in a configuration file which will be searched for in the following order:
|
||||||
|
|
||||||
|
ANSIBLE_CONFIG (environment variable if set)
|
||||||
|
ansible.cfg (in the current directory)
|
||||||
|
~/.ansible.cfg (in the home directory)
|
||||||
|
/etc/ansible/ansible.cfg
|
||||||
|
|
||||||
|
## Inventory
|
||||||
|
|
||||||
|
The default location for inventory should be placed in /etc/ansible/hosts. But you can always overwrite what inventory file is used with the -i flag
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Cheat Sheet
|
||||||
|
|
||||||
|
Quick notes for ansible via cmd
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible -i \inb
|
||||||
|
```
|
5
hosts
Normal file
5
hosts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[linux]
|
||||||
|
192.168.0.60 ansible_connection=ssh ansible_user=miharu
|
||||||
|
|
||||||
|
[windows]
|
||||||
|
192.168.0.2 ansible_connection=winrm ansible_user=ansible
|
6
playbook/linux/InstallDocker.yml
Normal file
6
playbook/linux/InstallDocker.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
- name: Install Docker
|
||||||
|
hosts: linux
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
36
playbook/linux/InstallPowerShellCore.yml
Normal file
36
playbook/linux/InstallPowerShellCore.yml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
- name: Install PowerShell Core
|
||||||
|
hosts: linux
|
||||||
|
#debugger: always
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Check if PowerShell is installed
|
||||||
|
#register: command_result
|
||||||
|
failed_when: "'Failed' PowerShell is already installed."
|
||||||
|
apt:
|
||||||
|
name: powershell
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Install Microsoft GPG Key
|
||||||
|
get_url:
|
||||||
|
url: https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
|
||||||
|
dest: /tmp/
|
||||||
|
|
||||||
|
- name: Register GPG Key
|
||||||
|
become: true
|
||||||
|
become_method: sudo
|
||||||
|
apt: deb="/tmp/packages-microsoft-prod.deb"
|
||||||
|
#command: dpkg -i ~/packages-microsoft-prod.deb
|
||||||
|
|
||||||
|
- name: Update repos and Install PowerShell Core
|
||||||
|
become: true
|
||||||
|
become_method: sudo
|
||||||
|
apt:
|
||||||
|
name: powershell
|
||||||
|
update_cache: yes
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Remove Extra files
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
path: /tmp/packages-microsoft-prod.deb
|
22
playbook/linux/UpdatePackages.yml
Normal file
22
playbook/linux/UpdatePackages.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
- name: Update Repos
|
||||||
|
hosts: linux
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Update Repos
|
||||||
|
become: true
|
||||||
|
become_method: sudo
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: Upgrade Packages
|
||||||
|
become: true
|
||||||
|
become_method: sudo
|
||||||
|
apt:
|
||||||
|
upgrade: yes
|
||||||
|
|
||||||
|
- name: Remove unused packages
|
||||||
|
become: true
|
||||||
|
become_method: sudo
|
||||||
|
apt:
|
||||||
|
autoremove: yes
|
Loading…
Reference in New Issue
Block a user