https://github.com/juju4/ansible-powershell
Set Powershell on linux, including config file and logging
https://github.com/juju4/ansible-powershell
Last synced: about 1 month ago
JSON representation
Set Powershell on linux, including config file and logging
- Host: GitHub
- URL: https://github.com/juju4/ansible-powershell
- Owner: juju4
- License: bsd-2-clause
- Created: 2022-10-29T22:15:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-01-24T22:56:14.000Z (about 1 month ago)
- Last Synced: 2026-01-25T09:07:42.009Z (about 1 month ago)
- Language: Jinja
- Size: 117 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/juju4/ansible-powershell/actions?query=branch%3Amaster)
[](https://github.com/juju4/ansible-powershell/actions?query=branch%3Adevel)
# powershell ansible role
Setup powershell, its config and logging under linux.
See also
* https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_logging_non-windows?view=powershell-7.2
* https://petri.com/how-powershell-7-logging-works-in-linux/
## Requirements & Dependencies
### Ansible
It was tested on the following versions:
* 2.13
### Operating systems
Tested on Ubuntu 20.04 and 22.04.
## Example Playbook
Just include this role in your list.
For example
```
- host: myhost
roles:
- juju4.powershell
```
you probably want to review variables
## Variables
```
powershell_config_template: powershell.config.json.j2
powershell_transcription_outputdir: /var/log/powershell/transcription
powershell_executionpolicy: RemoteSigned
powershell_enablescripts: true
powershell_enablemodule_logging: true
powershell_module_names:
- '*'
- PSReadline
- PowerShellGet
powershell_enableprotectedeventlogging: true
powershell_enabletranscripting: true
powershell_syslog_target: /var/log/powershell/powershell.log
powershell_logrotate_period: 'daily'
powershell_logrotate_rotate: 90
powershell_logrotate_compress: true
powershell_logrotate_delaycompress: true
powershell_logrotate_datext: true
powershell_logrotate_datformat: '-%Y%m%d'
```
## Continuous integration
```
$ pip install molecule docker
$ molecule test
$ MOLECULE_DISTRO=ubuntu:20.04 molecule test --destroy=never
```
## Troubleshooting & Known issues
* ExecutionPolicy setting does not work on Linux
```
PS /root> Set-ExecutionPolicy RemoteSigned
Set-ExecutionPolicy: Operation is not supported on this platform.
```
See also: https://github.com/powershell/powershell/issues/7573, https://github.com/PowerShell/PowerShell/issues/1998, https://learn.microsoft.com/en-us/powershell/scripting/whats-new/unix-support?view=powershell-7.2
## License
BSD 2-clause